Node.js vs Deno vs Bun: Express Hello World Performance

Mayank C
Tech Tonic

--

I’ve done numerous such comparisons in the past. However, things keep changing very fast these days. The last such comparison was executed a fairly long time back. Readers have been commenting/asking for updated articles. Therefore, starting a new series from this one.

Recently there have been new releases from all three:

  • Node.js v23
  • Deno v2
  • Bun v1.1.31

In this article, I’ll run a simple Express hello world application in Node.js, Deno, and Bun. We all know that the simplest ‘hello world’ is of no practical use, but we also know that this is the most usual starting point. Subsequently, we’ll go for advanced variants such as database read, file server, etc.

I’ll take the measurements to find out who is the fastest. Note that I’m not using the native servers. I’ll be using the most popular Express for this comparison.

The code is as follows:

import express from "express";

const app = express();

const reqHandler = (req, res) => {
res.send("Hello World!");
};

app.get("/", reqHandler);

app.listen(3000, () => console.log("Listening on 3000"));

The same application works fine in Node.js, Deno, and Bun.

All tests are executed on MacBook Pro M2 with 16G of memory.

As always, I’ve used Bombardier load testing tool for running the tests.

I’m executing a single test with 100 concurrent connections to reach 1M requests. A warm-up of 1000 requests is provided before starting the measurements.

It is time to get into the results. The results in bar chart form are as follows:

If you prefer tables, here are the same results in a concise tabular format:

Well, Bun just crushed the competition for this simplest use case. Bun turns out to be 4 times faster than Node.js and ~2.5 times faster than Deno. To achieve this remarkable performance, Bun uses less CPU and memory. Definitely a winner in all aspects!

Winner: BUN

Next, I’ll run the same test for fastify (Another popular choice). Then I’m going to add a DB call to read some user record and return it in HTTP response. That’d be an interesting case. I’m curious to see how Bun fares in that use case.

Thanks for reading!

UPDATE:

If you would like to see the same comparison for Fastify, it is now available here.

--

--

Tech Tonic
Tech Tonic

Published in Tech Tonic

Articles on popular things like Node.js, Deno, Bun, etc.

Mayank C
Mayank C

Responses (1)