DEV Community

jalelagrebi
jalelagrebi

Posted on

Bun faster than node .

I’m comparing server-side rendering (SSR) for an Angular application using two JavaScript runtimes — Node.js and Bun — to evaluate performance. This test will deploy the same Angular SSR build in both environments, measure cold and warm startup times, request throughput and latency under load, memory usage. The goal is to determine whether Bun’s performance-oriented design and built-in tooling offer meaningful advantages over the established Node.js ecosystem for Angular SSR.

Node

let's create new angular 19 project with npm (node v24) (ssr)

ng new testangularbun

and follow instruction ....

hit npm i

then npm run build

last serve:ssr:testangularbun

Browse http://localhost:4200/

you should se the beautifull angular page :)

now comming to the interresting part

in the root of the project
create new Docker file with the following content

docker build -f Dockerfile . -t testnode
once done you should see this in Docker desktop


Bun

let's start by insalling Bun v 1.0.3
you can follow this https://bun.com/docs

**

curl -fsSL https://bun.com/install | bash
Enter fullscreen mode Exit fullscreen mode


**
you can test it after restarting you terminal by typing bun --version

one small thing to change is your docker file
here is the new file

then hit
docker build -f Dockerfile .
now you will see the new Docker image running with bun ! amazing xD

_*Last step *

let's load test the too running images ...
install autocannon
here -> https://formulae.brew.sh/formula/autocannon
in your terminal hit
$ autocannon -c 100 -d 10 http://localhost:4200
_

here is the result's
node :

bun :

Conclusion :

Bun demonstrated consistently faster performance than Node.js for this Angular SSR workload. Bun’s optimized JavaScript engine and native-built tooling produced quicker cold starts and higher requests-per-second in our tests, while using comparable or lower memory. Although some minor compatibility adjustments were required for certain Node-specific modules, they did not offset the overall runtime gains. Therefore, for this Angular SSR project, Bun is the faster runtime and a compelling choice when raw request performance and startup speed are priorities; projects with deep Node-native dependencies should still evaluate compatibility before migrating.

Top comments (0)