Home

Awesome

Bun HTTP Framework Benchmark

Compare throughput benchmarks from various JavaScript HTTP framework

Test method: Average throughput

  1. Ping
    • Request to [GET] /
    • Return hi
    • Headers must contains text Content-Type: text/plain, additional context is acceptable eg. Content-Type: text/plain; charset=utf-8
  2. Query
    • Request to [GET] /id/:id
    • Extract path parameter, query string and setting headers.
    • For this benchmark, the request URL will be send as: /id/1?name=bun
    • Headers must contains x-powered-by to benchmark
    • Expected response: "1 bun" (${id} ${query})
      • You MUST NOT use hardcode string or index to extract querystring.
      • 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.
      • 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:
      • /id/1?name=bun&id=1 -> should return 1 bun not 1 bun&id=1
      • /id/1?id=1 -> should return 1
      • Query beside name maybe not need to be extracted and is optional
    • Headers must contains text Content-Type: text/plain, additional context is acceptable eg. Content-Type: text/plain; charset=utf-8
  3. Body
    • [POST] /json
    • Mirror body to response
    • Server MUST parse body to JSON and serialize back to string
    • For the benchmark, the request body will be sent as: { "hello": "world" }
    • Expected response: { "hello": "world" }
    • Headers must contains text Content-Type: application/json, additional context is acceptable eg. Content-Type: application/json; charset=utf-8.

requirement

Prerequistes

Run Test

bun benchmark

Dump result will be available at results/[benchmark-name].txt

Benchmark Condition

This benchmark is tested under the following condition:

Tested on 10 Oct 2024 02:04 (GMT+7)

Results

These results are measured in req/s:

FrameworkRuntimeAveragePingQueryBody
uwsnode522,827.833534,617.26501,852.04532,014.2
bunbun420,637.837535,794.82332,534.17393,584.52
elysiabun402,500.15537,823.18310,490.05359,187.22
vixenybun355,799.453388,645.4315,925.07362,827.89
hyper-expressnode315,922.07369,552.41300,347.16277,866.64
wobebun312,237.51297,324.2288,859.74350,528.59
bun-web-standardbun306,997.287343,897.06261,194.14315,900.66
nhttpbun290,254.55383,137.72253,369.86234,256.07
honobun258,790.057301,981.83239,629.52234,758.82
denodeno245,589.31265,765.7232,579.03238,423.2
nbitbun236,476.243260,526.71204,210.92244,691.1
ultimate-expressnode236,056.59252,259.64238,642.52217,267.61
honodeno204,650.553254,085.18199,150.72160,715.76
deno-web-standarddeno204,346.857235,673.11181,753.89195,613.57
fastifynode140,703.297154,398.09145,754.27121,957.53
hononode124,492.93137,581.65129,470.13106,427.01
oakbun124,471.613123,234.73113,438.15136,741.96
expressbun123,098.917135,516.99118,745.67115,034.09
h3bun117,410.4144,300.06111,128.2396,802.91
koanode102,251.6113,321.47100,713.292,720.13
oakdeno99,657.137104,906.7393,028.44101,036.24
h3node96,766.003127,440.46111,172.7751,684.78
acorndeno64,489.2593,958.2371,414.6928,094.83
expressnode29,761.44730,716.5629,673.7828,894

See more detail in results

Notice

I highly recommended testing this benchmark on your machine yourself as performance in likely to vary between machine.

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