Node.js vs Deno vs Bun: Fastify 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, continuing the new series that has been started with Express hello world comparison.

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 Fastify 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.

Before we go for Fastify (the fastest known production grade framework for Node.js), let’s take a look at the RPS results for Express hello world comparison:

For Express hello world, Bun turned out to be 4 times faster than Node.js and around 2 times faster than Deno.

Now coming to Fastify. 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 performant production grade framework (Fastify) for this comparison.

The code is as follows:

import Fastify from "fastify";

const fastify = Fastify({
logger: false,
});

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

fastify.get("/", reqHandler);

fastify.listen({ port: 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:

The results have surprised me. Bun is still the fastest of the three. However, for a Fastify application, the winning margin is not much as it was for Express application. Deno is the worst of all. Node.js offers 83K RPS, while Bun offers 96K RPS. Deno stands at 63K RPS. Perhaps, Fastify plays to the strengths of Node.js, but not for Deno and Bun.

For winner, I’ll still pick Bun.

Next, I’ll be running a test with the fastest known frameworks for Node.js, Deno, and Bun. I’ll be using Fastify, Hono, and Elysia respectively.

Thanks for reading!

--

--

Tech Tonic
Tech Tonic

Published in Tech Tonic

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

Mayank C
Mayank C

No responses yet