Deno — Express vs Fastify vs Oak vs Hono: Who’s runs fastest?

Mayank Choubey
Tech Tonic
Published in
3 min readOct 5, 2023

--

In the world of Deno, there’s a plethora of options available for running web applications. Well-known frameworks like Express and Fastify, which originally come from the Node ecosystem, seamlessly integrate with Deno. Additionally, there are specialized frameworks like Oak and Hono, meticulously crafted and optimized specifically for Deno and Bun.

In the following sections, we will explore a simple “hello world” use case to compare the functionality and performance of these four popular choices: Express, Fastify, Oak, and Hono.

Test setup

Environment

For our performance testing, we utilized a MacBook Pro M1 equipped with 16GB of RAM. To gauge Deno’s capabilities under various loads, we employed the Bombardier load tester, a reliable tool for stress testing applications. At the time of writing, we utilized Deno version 1.37.1, the most recent release available.

Application Code

Here’s the basic code structure of our “Hello World” application:

Express

import express from "npm:express";
const app = express();
const port = 3000;

app.get("/", (_, res) => {
res.send("Hello World!");
});

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

Fastify

import Fastify from "npm:fastify";
const fastify = Fastify({ logger: false });

fastify.get("/", () => {
return "Hello world!";
});

fastify.listen({ port: 3000 });

Oak

import { Application } from "https://deno.land/x/oak/mod.ts";

const app = new Application();

app.use((ctx) => {
ctx.response.body = "Hello World!";
});

await app.listen({ port: 3000 });

Hono

import { Hono } from "npm:hono";

const app = new Hono();

app.get("/", (c) => c.text("Hello World!"));

Deno.serve({ port: 3000 }, app.fetch);

Results

In this test scenario, the frameworks are subject to a rigorous evaluation comprising 2 million requests, all executed concurrently with 100 active connections.

Here is a visual representation of the results in chart form:

Verdict

In performance testing, Express emerged as the slowest option, while Hono, specifically designed for Deno and Bun, demonstrated remarkable speed, making it the fastest among the tested frameworks. Fastify and Oak delivered comparable results, falling between the performance spectrum of Express and Hono.

WINNER: Hono

--

--