Hello World Benchmarks

These benchmarks are based on the fastify benchmarks repo! in fact our goal is to perform similar to fastify as we considered it the industry standard in terms of performance.

mion is focused on being lightweight and fast so it can be run in serverless environments. We run the benchmarks before every PR gets merged to ensure there is no performance regression.

Please always take benchmarks as general guidelines as you might obtain different results in your real world application. we just run the benchmarks to ensure there is no performance degradation when new features/fixes are added to mion.

What is tested?

This Hello World benchmark involves mostly routing as there is no validation.

This is a simple hello world scenario, is a good indicator of the router performance and theoretical upper limit of each framework.

// ### mion ###
export const routes = {
  sayHello: (): string => ({hello: "world"}),
} satisfies Routes;

// ### Express ###
app.get("/sayHello", function (req, res) {
  res.json({ hello: "world" });
});

Notes

mion creates standard Request, Response & Headers Object for each incoming request. This is so mion can be used in multiple platforms. Even if we sacrifice a bit of performance in exchange for flexibility, mion is still pretty performant.


Benchmarks

  • Machine: darwin x64 | 8 vCPUs | 16.0GB Mem
  • Node: v20.11.0
  • Run: Mon Jan 29 2024 22:27:22 GMT+0000 (Greenwich Mean Time)
  • Method: autocannon -c 100 -d 40.02 -p 10 localhost:3000 (two rounds; one to warm-up, one to measure)

Req (R/s)

Throughput (Mb/s)

Latency (ms)

Max Memory (Mb)

Memory Series (MB)


Results Table

VersionRouterReq (R/s)Latency (ms)Output (Mb/s)Max Memory (Mb)Max Cpu (%)ValidationDescription
mion.bun0.6.2โœ“63724.815.199.9187107โœ“mion using bun, automatic validation and serialization
http-node16.18.0โœ—39481.624.837.0481129โœ—bare node http server, should be the theoretical upper limit in node.js performance
fastify4.10.2โœ“39065.625.107.0087123-Validation using schemas and ajv. schemas are generated manually
mion0.6.2โœ“33488.629.356.7191127โœ“Automatic validation and serialization out of the box
hono3.12.6โœ“29306.033.615.2389123โœ—hono node server, manual validation or third party tools
hapi21.3.2โœ“26155.637.724.66101128โœ—validation using joi or third party tools
restify11.1.0โœ“10475.894.942.59165144โœ—manual validation or third party tools
express4.18.2โœ“8172.9121.701.46121126โœ—manual validation or third party tools
Benchmarks Repo