본문 바로가기

smells digital

Node.js의 대안? Bun

bun 이라는 귀여운 이미지를 상징으로 하는 노드의 대안인 자바 스크립트 런타임(Runtime)이 있다.

사이트 주소는 https://bun.sh 

 

Bun — A fast all-in-one JavaScript runtime

Bun implements the Web-standard APIs you know and love, including fetch, ReadableStream, Request, Response, WebSocket, and FormData.

bun.sh

이미 10년이 넘은 노드(2009)에 비해서 발표된 지 얼마 안되는(2021년) 신상이다.

후발주자 답게 성능으로 노드보다 상당히 빠르다고 한다.

기본 언어도 JavaScript 가 아닌 TypeScript 이다.

장점으로는 노드 코드가 어느정도 호환이 된다는 건데

현재 ts-node와 typeOrm을 사용하는 프로젝트 하나를 bun으로 동작시켜 보니 TypeOrm 에서 에러가 발생해서 안된다.

 

기능 비교표다.

노드를 만든 라이언 달이 만든 디노(Deno)도 노드의 대안으로 손꼽히고 있다보니 함께 비교하는 자료가 많다.

기능 비교표

https://dev.hexagon.56k.guru/posts/deno-vs-bun-vs-node/

 

Deno vs. Bun vs. Node.js: A Feature Comparison

Description

hexagon.56k.guru

 

성능 벤치마크 자료다.

성능으로 보자면 약 2-3배 정도이다.

다만 단순 헬로 월드 응답을 하는 서버로 비교한 것이라서,

실제 프로덕트 서버에서 동작시킨다고 2-3배의 성능 향상이 난다고 보장은 못하겠지.

https://medium.com/deno-the-complete-reference/node-js-vs-deno-vs-bun-native-http-hello-world-server-benchmarking-f48edd514513

 

Node.js vs Deno vs Bun: Native HTTP hello world server benchmarking

Find out whose native HTTP server is fastest for a simple hello world case: Node.js, Deno, or Bun?

medium.com

 

 

 

반응형