Node.js vs Deno vs Bun: Express hello world server benchmarking

Mayank Choubey
Tech Tonic
4 min readSep 12, 2023

--

Introduction

This article responds to one of the most frequently requested updates: a fresh comparison of technologies like Deno and Bun, which have recently enhanced their server capabilities. Deno, starting from version 1.36, has introduced a highly efficient HTTP server called “flash,” while Bun has reached its 1.0 release milestone, boasting improved performance and reduced resource consumption. Node.js, the king of JS runtimes, doesn’t even bother to offer anything faster than what they’ve. Given these significant developments, at least on Deno and Bun, it’s evident that an updated comparison is long overdue.

In this article, we’ll take a look again at the express based HTTP servers in Node.js, Deno, and Bun.

Without any delay, let’s dive right into configuring our test environment.

Test setup

In this section, we will conduct benchmark tests using a MacBook Pro M1 with 16GB of RAM as our testing environment. The load testing tool employed for these tests is Bombardier. To ensure the accuracy of our assessments, we are using the most current software versions available at the time of writing:

- Node.js v20.6.0
- Deno 1.36.4
- Bun v1.0.0

Code

The focus of this article is solely on express HTTP servers. We’ve already seen how native servers and fastify servers perform for a simple hello world case.

The express application code remains consistent across all three technologies — Node.js, Deno, and Bun. In essence, the identical express application seamlessly operates within the Node.js, Deno, and Bun environments. To add an extra layer of intricacy, we are generating a nanoid and including it in the response headers.

import express from "express";
import { nanoid } from "nanoid";

const app = express();

app.get("/", (_, res) => {
res.set("x-req-id", nanoid(10));
res.send("Hello World!");
});
app.listen(3000, () => console.log("Listening on 3000"));

Results

In order to assess the performance of technologies such as Node.js, Deno, and Bun, we conducted a series of tests. Each test involved the execution of 1 million requests under three different scenarios: 50 concurrent connections, 100 concurrent connections, and 300 concurrent connections. The test results have been visually represented in chart format for easy analysis and interpretation.

Verdict

Bun did outperform others for the native hello world case (article is here). In this straightforward “express hello world” test, Bun continues it’s winning streak by outperforming both Node.js and Deno, demonstrating remarkable speed. Specifically, the same express server in Bun is twice as fast as Node.js and 1.5 times faster than Deno. Furthermore, the resource utilization of Bun is quite comparable.

WINNER: Bun

A comparison with native server is here, and with fastify server is here.

--

--