Performance 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 is a simple hello world scenario, this is a good indicator of the routing overhead 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" });
});

Benchmarks

  • Machine: darwin x64 | 8 vCPUs | 16.0GB Mem
  • Node: v18.17.0
  • Run: Sat Oct 07 2023 14:22:34 GMT+0100 (Irish Standard Time)
  • Method: autocannon -c 100 -d 40.33 -p 10 localhost:3000 (two rounds; one to warm-up, one to measure)

Req (R/s)

benchmarks

Throughput (Mb/s)

benchmarks

Latency (ms)

benchmarks

Max Memory (Mb)

benchmarks

Memory Series (MB)

benchmarks

Results Table

FrameworkVersionRouterReq (R/s)Latency (ms)Output (Mb/s)Max Memory (Mb)Max Cpu (%)ValidationDescription
mion.bun0.6.2โœ“58232.016.819.0583107โœ“mion using bun, automatic validation and serialization
http-node16.18.0โœ—35717.627.506.3786118โœ—bare node http server, should be the theoretical upper limit in node.js performance
fastify4.10.2โœ“31738.831.055.6993117-Validation using schemas and ajv. schemas are generated manually or using third party tools
mion0.6.2โœ“29064.033.905.8296121โœ“Automatic validation and serialization out of the box
deepkit1.0.1-alpha.75โœ“25878.038.144.61186135โœ“Automatic validation and serialization out of the box
hapi21.3.2โœ“23416.842.194.18118127โœ—validation using joi or third party tools
restify11.1.0โœ“10193.497.462.52104124โœ—manual validation or third party tools
express4.18.2โœ“7952.2125.091.42135125โœ—manual validation or third party tools