#Why is node 2.8x faster than bun in this data processing benchmark?

1 messages · Page 1 of 1 (latest)

merry robin
honest maple
#

I noticed replacing the .forEach functions with for loops made the performance a very close tie between deno, bun and node on my laptop

honest maple
#

I'm getting roughly the same ~2-3x longer Processing Time on Bun compared to Node on an Mac M1 pro for the benchmark out of the box.

#

on Bun v1.0.3

#

Node v18.17.0

merry robin
#

I guess this is more of a test between v8 and jscore. Though node also beats deno

honest maple
#
| Framework              | Average     | Get (/)    | Params, query & header | Post JSON |
|------------------------|-------------|------------|------------------------|-----------|
| bun (bun)              | 101,340.427 | 116,602.03 | 97,748.64              | 89,670.61 |
| hyper-express (node)   | 93,630.72   | 112,906.79 | 103,652.45             | 64,332.92 |
| bun-web-standard (bun) | 86,040.763  | 104,407.93 | 83,313.92              | 70,400.44 |
| uws (node)             | 85,733.407  | 92,558.09  | 83,677.56              | 80,964.57 |
| stricjs (bun)          | 85,311.623  | 93,271.22  | 87,136.48              | 75,527.17 |
| vixeny (bun)           | 84,878.343  | 93,518.46  | 89,003.9               | 72,112.67 |
| elysia (bun)           | 81,757.027  | 88,578.9   | 83,384.45              | 73,307.73 |
| hono (bun)             | 79,800.303  | 88,887.74  | 78,380.41              | 72,132.76 |
| nhttp (bun)            | 79,582.877  | 93,642.51  | 73,851.31              | 71,254.81 |
| baojs (bun)            | 78,973.687  | 86,773.42  | 77,495.79              | 72,651.85 |
| hono (deno)            | 76,447.127  | 85,885.06  | 82,731.47              | 60,724.85 |
| hyperbun (bun)         | 68,473.023  | 76,708.06  | 66,223.61              | 62,487.4  |
| nbit (bun)             | 67,542.2    | 73,676.06  | 67,236.89              | 61,713.65 |
| xirelta (bun)          | 56,987.37   | 57,096.95  | 53,740.52              | 60,124.64 |
| fast (deno)            | 48,523.847  | 52,256.66  | 48,434.12              | 44,880.76 |
| fastify (node)         | 47,316.27   | 51,433.01  | 46,861.36              | 43,654.44 |
| h3 (node)              | 43,279.003  | 49,154.67  | 42,275.9               | 38,406.44 |
| fastify (bun)          | 42,089.757  | 51,962.22  | 49,631.44              | 24,675.61 |
| koa (node)             | 36,929.583  | 40,510.99  | 37,555.71              | 32,722.05 |
| adonis (node)          | 35,185.427  | 33,866.05  | 35,881.92              | 35,808.31 |
| abc (deno)             | 33,599.1    | 40,404.07  | 36,339.01              | 24,054.22 |
| cheetah (deno)         | 33,178.747  | 34,518.58  | 42,557.33              | 22,460.33 |
| oak (deno)             | 31,013.76   | 34,215.38  | 32,901.24              | 25,924.66 |
| express (bun)          | 29,080.373  | 35,570.24  | 33,889.22              | 17,781.66 |
| hapi (node)            | 27,637.873  | 37,840.73  | 19,964                 | 25,108.89 |
| hono (node)            | 17,864.063  | 20,325.2   | 19,278.49              | 13,988.5  |
| express (node)         | 15,953.73   | 17,646.83  | 16,430.56              | 13,783.8  |
| nest (node)            | 14,937.14   | 16,244.13  | 15,297.12              | 13,270.17 |
| acorn (deno)           | 5,631.123   | 10,952.12  | 3,320.73               | 2,620.52  |
#

both hyper-express (node) and bun gives you a very close ~6x req/s compared to express (node)

honest maple
honest maple
#

Node: 154ms
Bun: 324ms
Rust: 34ms
Bun+Rust FFI: 46ms

#

Interesting to see FFI being a pretty good option for your bun project if you really need the extra performance

merry robin
#

Update: bun is now the fastest js runtime:

JS (Bun)     7.42 s
JS (Deno)    14.19 s
JS (Node)    14.60 s