These benchmarks are based on the Fastify benchmarks repo. Our goal is to perform similarly to Fastify as we consider it the industry standard in terms of performance.
The test consists of an updateSimpleUser request with a simple User model (~100 bytes payload) that includes:
interface SimpleUser {
id: number;
name: string;
surname: string;
lastUpdate: Date;
}
// ### mion ###
// the received user by the route is already validated and deserialized
// all Date fields are already JS Date objects (not strings from JSON.parse)
export const routes: Routes = {
updateUser: (ctx, user: SimpleUser): SimpleUser => {
user.lastUpdate = new Date();
return user;
},
};
// ### Other frameworks (Express, Fastify, Hono, etc.) ###
// Use Zod schemas for validation and date coercion
const UserSchema = z.object({
id: z.number(),
name: z.string(),
surname: z.string(),
lastUpdate: z.coerce.date(),
});
app.post("/updateUser", function (req, res) {
const user = UserSchema.parse(req.body); // Validates + deserializes dates
user.lastUpdate = new Date();
res.json(user);
});
We can observe how in this benchmark the requests take considerably more time compared with the 'hello world' benchmark. This is mostly because each request is spending extra time on validation and serialization.
For this specific test, the performance of the libraries used for validation and serialization might be more important than the routing itself.
v24.13.0autocannon -c 100 -d 20.1 -p 10 localhost:3000 (two rounds; one to warm-up, one to measure)| Version | Router | Req (R/s) | Latency (ms) | Output (Mb/s) | Max Memory (Mb) | Max Cpu (%) | Validation | Description | |
|---|---|---|---|---|---|---|---|---|---|
| http-node | 16.18.0 | ✗ | 71516.8 | 13.54 | 17.93 | 145 | 108 | ✓ | bare node http server with Zod validation |
| mion.bun | 0.6.2 | ✓ | 70662.4 | 13.72 | 17.24 | 66 | 98 | ✓ | mion using bun, automatic validation and serialization |
| hono.bun | 3.12.6 | ✓ | 69801.6 | 13.93 | 13.37 | 72 | 94 | ✓ | hono bun server with Zod validation |
| elysia.bun | 1.0.0 | ✓ | 69360.0 | 14.02 | 13.29 | 91 | 94 | ✓ | Elysia framework with TypeBox validation |
| mion | 0.6.2 | ✓ | 63504.0 | 15.24 | 18.34 | 157 | 110 | ✓ | Automatic validation and serialization out of the box |
| fastify | 5.7.4 | ✓ | 46017.6 | 21.23 | 11.58 | 311 | 134 | ✓ | Fastify with native JSON Schema validation |
| express | 5.2.1 | ✓ | 45132.8 | 21.65 | 11.32 | 176 | 117 | ✓ | Express with Zod validation |
| hapi | 21.4.4 | ✓ | 41270.4 | 23.72 | 10.35 | 266 | 112 | ✓ | Hapi with Zod validation |
| hono | 3.12.6 | ✓ | 33037.6 | 29.74 | 7.81 | 1117 | 135 | ✓ | hono node server with Zod validation |