Focus on framework features.
Example code for benchmark.
// GET /
framework.get("/", (req, res) => {
res.send("home");
});
// GET /blog/99?title=bench (params and queryParams)
framework.get("/blog/:id", (req, res) => {
const data = `${req.params.id} ${req.query.title}`;
res.send(data);
});
// GET /api/user (set header & send json)
framework.get("/api/user", (req, res) => {
res.setHeader("x-powered-by", "bench");
res.json({ user: "john" });
});
Created At : Mon Oct 14 2024, 12:51:43 AM
Created By : bot_ci
Name | AVG | GET / | GET /blog/:id | GET /api/user |
---|---|---|---|---|
nhttp | 48748 | 52283 | 47850 | 46112 |
hono | 48019 | 50560 | 49192 | 44306 |
fast | 47400 | 51207 | 45108 | 45884 |
oak | 25609 | 26364 | 25116 | 25348 |
Name | AVG | GET / | GET /blog/:id | GET /api/user |
---|---|---|---|---|
nhttp | 26059 | 34049 | 22965 | 21164 |
fastify | 16937 | 17399 | 16852 | 16559 |
koa | 14195 | 15168 | 13075 | 14343 |
express | 6356 | 6561 | 5944 | 6562 |
Name | AVG | GET / | GET /blog/:id | GET /api/user |
---|---|---|---|---|
elysia | 74751 | 84455 | 74302 | 65497 |
nhttp | 62877 | 82793 | 54130 | 51708 |
hono | 58925 | 74690 | 51920 | 50166 |
baojs | 37606 | 46011 | 35675 | 31133 |
git clone https://github.com/herudi/deno_benchmark.git
cd deno_benchmark
// for_all
deno task bench
// for_single
deno task bench framework_name