Mercurial
annotate benchmark/bun-http-framework-benchmark/README.md @ 209:3b47e82ac57e
[MrJuneJune] PWA updates.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Sun, 15 Feb 2026 15:43:26 -0800 |
| parents | a8976a008a9d |
| children |
| rev | line source |
|---|---|
|
183
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
1 # Bun HTTP Framework Benchmark |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
2 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
3 Compare throughput benchmarks from various JavaScript HTTP framework |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
4 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
5 Test method: Average throughput |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
6 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
7 1. Ping |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
8 - Request to [GET] `/` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
9 - Return `hi` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
10 - Headers must contains text `Content-Type: text/plain`, additional context is acceptable eg. `Content-Type: text/plain; charset=utf-8` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
11 2. Query |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
12 - Request to [GET] `/id/:id` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
13 - Extract path parameter, query string and setting headers. |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
14 - For this benchmark, the request URL will be send as: `/id/1?name=bun` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
15 - Headers must contains `x-powered-by` to `benchmark` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
16 - Expected response: **"1 bun"** (`${id} ${query}`) |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
17 - You **MUST NOT use hardcode string or index** to extract querystring. |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
18 - In a real-world situation, there's no enforcement that the request will follow the specification, using hardcode index to extract `name=bun` querystring will be prone to error. |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
19 - To test if it pass the requirement, the implementation should be able to extract querystring **dynamically** (please treat the value of 'name=bun' can be any value beside 'bun', for example 'alice', 'hina'), which means that the same code should be able to extract querystring, for example: |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
20 - `/id/1?name=bun&id=1` -> should return `1 bun` not `1 bun&id=1` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
21 - `/id/1?id=1` -> should return `1 ` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
22 - Query beside `name` maybe not need to be extracted and is optional |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
23 - Headers must contains text `Content-Type: text/plain`, additional context is acceptable eg. `Content-Type: text/plain; charset=utf-8` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
24 3. Body |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
25 - [POST] `/json` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
26 - Mirror body to response |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
27 - Server **MUST parse body to JSON and serialize back to string** |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
28 - For the benchmark, the request body will be sent as: `{ "hello": "world" }` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
29 - Expected response: `{ "hello": "world" }` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
30 - Headers must contains text `Content-Type: application/json`, additional context is acceptable eg. `Content-Type: application/json; charset=utf-8`. |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
31 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
32 ## requirement |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
33 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
34 - The framework must at-least has latest published in less than 9 month otherwise will be classified as unmaintained and removed unless is an industry standard (Express). |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
35 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
36 # Prerequistes |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
37 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
38 - [bombardier](https://github.com/codesenberg/bombardier) |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
39 - Nodejs |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
40 - Deno |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
41 - Bun |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
42 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
43 # Run Test |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
44 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
45 ```typescript |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
46 bun benchmark |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
47 ``` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
48 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
49 Dump result will be available at `results/[benchmark-name].txt` |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
50 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
51 ## Benchmark Condition |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
52 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
53 This benchmark is tested under the following condition: |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
54 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
55 - Intel I7-13700K, DDR5 32GB 5600MHz |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
56 - Arch Linux 6.10.9-arch1-2 (btw I use Arch) |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
57 - Bun 1.2.11 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
58 - Node 22.15.0 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
59 - Deno 2.2.0 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
60 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
61 Tested on 6 May 2025 20:55 (GMT+7) |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
62 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
63 ## Results |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
64 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
65 These results are measured in req/s: |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
66 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
67 | Framework | Runtime | Average | Ping | Query | Body | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
68 | ---------------- | ------- | ------- | ---------- | ---------- | ---------- | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
69 | uws | node | 526,295.397 | 535,079.45 | 509,759.27 | 534,047.47 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
70 | ultimate-express | node | 416,645.31 | 526,907.98 | 508,436.34 | 214,591.61 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
71 | elysia | bun | 397,259.163 | 533,560.05 | 300,716.41 | 357,501.03 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
72 | bun | bun | 366,716.193 | 386,961.93 | 317,958.96 | 395,227.69 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
73 | hyper-express | node | 315,844.147 | 370,809.65 | 299,522.59 | 277,200.2 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
74 | bun-web-standard | bun | 303,568.81 | 338,462.84 | 255,297.65 | 316,945.94 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
75 | nhttp | bun | 283,734.777 | 373,377.37 | 244,767.65 | 233,059.31 | | wobe | bun | 282,858.987 | 282,509.03 | 250,687.47 | 315,380.46 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
76 | hono | bun | 253,646.173 | 294,945.14 | 236,066.25 | 229,927.13 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
77 | deno | deno | 247,770.227 | 269,520.16 | 233,460.27 | 240,330.25 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
78 | nbit | bun | 229,226.153 | 252,902.81 | 196,843.1 | 237,932.55 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
79 | deno-web-standard | deno | 204,908.633 | 236,235.96 | 183,458.05 | 195,031.89 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
80 | hono | deno | 201,548.523 | 250,592.98 | 195,744.04 | 158,308.55 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
81 | fastify | node | 142,695.487 | 155,142.07 | 148,078.23 | 124,866.16 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
82 | hono | node | 129,234.593 | 144,842.92 | 134,412.44 | 108,448.42 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
83 | express | bun | 126,674.41 | 145,427.54 | 134,805.54 | 99,790.15 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
84 | oak | bun | 120,481.7 | 117,743.45 | 109,295.56 | 134,406.09 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
85 | h3 | bun | 109,739.16 | 132,720.75 | 104,854.13 | 91,642.6 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
86 | h3 | node | 101,237.803 | 136,023.12 | 111,361.83 | 56,328.46 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
87 | oak | deno | 100,205.983 | 105,824.67 | 93,335 | 101,458.28 | | koa | node | 96,456.887 | 103,217.62 | 97,582.12 | 88,570.92 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
88 | acorn | deno | 64,951.337 | 95,734.91 | 71,099.63 | 28,019.47 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
89 | express | node | 25,079.01 | 26,286.22 | 24,796.49 | 24,154.32 | |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
90 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
91 See more detail in [results](https://github.com/SaltyAom/bun-http-framework-benchmark/tree/main/results) |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
92 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
93 ## Notice |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
94 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
95 I highly recommended testing this benchmark on your machine yourself as performance in likely to vary between machine. |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
96 |
|
a8976a008a9d
[BenchMark] Added bun bench mark to test seoboe vs other popular benchmarks.
MrJuneJune <me@mrjunejune.com>
parents:
diff
changeset
|
97 If you are unable to run Deno, please run each Deno app individually first until the Deno finish installing the package, then proceed to run benchmark using `bench.sh` or `npm run benchmark` |