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

Mayank Choubey
Tech Tonic
4 min readSep 12, 2023

--

An update of this article has been published here.

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 native HTTP servers in Node.js, Deno, and Bun.

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

A similar comparison with Express can be seen here, and with fastify can be seen here.

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 native HTTP servers.

Node.js

import http from "node:http";

http.createServer((req, resp) => {
resp.writeHead(200, {
"content-type": "text/plain",
});
resp.end("Hello world");
}).listen(3000);

Deno

Deno.serve({
port: 3000,
}, (_) => new Response("Hello world!"));

Bun

Bun.serve({
port: 3000,
fetch(_) {
return new Response("Hello world!");
},
});

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 5 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

While we acknowledge that the basic “hello world” scenario may not fully represent real-world use cases, it serves as a valuable initial benchmark. In this straightforward “hello world” test, Bun’s native server outperforms both Node.js and Deno, demonstrating remarkable speed. Specifically, Bun’s native server is twice as fast as Node.js and 1.5 times faster than Deno in this context. Furthermore, the resource utilization of Bun’s native server is notably lower, making it an intriguing choice for lightweight and efficient applications.

WINNER: Bun

A similar comparison with Express can be seen here and with fastify can be seen here.

--

--