Skip to content
Nilay Kabariya

Entry No.011·Tested·Updated ·5 min read

Bun vs Node.js 24 benchmark: startup, TypeScript and tests

The same code run on Bun 1.4 and Node 24 on an ordinary laptop: startup, running TypeScript directly, CPU work and a test suite. One result went Node's way.

by Nilay#bun#node#typescript#performanceTESTED

Verdict

Bun started 1.7× faster, ran a TypeScript file 3× faster and finished the same test suite 5× faster. The tight number-crunching loop was close: Node won it on Bun 1.4.2, and on 1.4.3 it was a toss-up. The HTTP test hit a limit of this machine, not of either runtime.

Tested on

Node
24.14.0
Bun
1.4.2 (re-checked on 1.4.3, Oct 11; Linux re-run on 1.4.3 and 1.4.4, Nov 3)
Machine
i3-1115G4, 2 cores, 12 GB, NVMe SSD
OS
Windows 11 Pro 26200

✓ Last re-run on GitHub Actions · see the run · all repros

Same machine, same files, and wherever possible the exact same code on both runtimes. Every number below is a median of repeated runs, and both runtimes had to produce the identical result (checksum 864579) for the CPU test to count.

The results

Startup: run an empty scriptlower is better · ms
  1. Bun34.5 msbest
  2. Node58.7 ms
Run a TypeScript file directly (no build step)lower is better · ms
  1. Bun36.8 msbest
  2. Node114.0 ms
Test runner: the same 300 node:test testslower is better · ms
  1. Bun76 msbest
  2. Node381 ms
CPU: sort 2 million numberslower is better · ms
  1. Bun578 msbest
  2. Node1372 ms
CPU: JSON round-trip of 200,000 objectslower is better · ms
  1. Bun245 msbest
  2. Node331 ms
CPU: prime sieve up to 10 millionlower is better · ms
  1. Node113 msbest
  2. Bun125 ms

What that means in practice

  • Scripts, CLIs and dev tooling feel faster on Bun. It starts about 1.7× faster. For anything you run many times a day (scripts, git hooks, one-off tools), that adds up.
  • Running TypeScript without a build: both can now do it, but Bun was about 3× faster here (37 ms vs 114 ms). Node 24 strips types natively, which is convenient, but it doesn’t match Bun’s startup.
  • Tests: bun test ran the same 300 node:test tests about 5× faster than node --test, partly because node --test runs each test file in its own child process, so even this single file paid for a second Node startup.
  • Raw computation is closer than the headlines suggest. Bun sorted about 2.4× faster and did JSON about 1.35× faster, but Node won the tight loop (the prime sieve) by about 10%. On the Bun 1.4.3 re-check below, that loop was a toss-up. If your app is mostly number-crunching, don’t switch for speed alone.
  • Node is still the safe default for compatibility: every npm package and tool is built for it first. Bun is worth it where its speed shows up directly: scripts, tests and TypeScript tooling.

The HTTP test didn’t count, and why

I also load-tested an identical node:http server on both runtimes, plus Bun’s own Bun.serve. All three landed at about 600–700 requests per second, suspiciously equal and far too low for a “hello world” server.

To compare HTTP throughput, run it on Linux or on separate client and server machines.

Re-checked on Bun 1.4.3

When Bun 1.4.3 came out, I ran Bun 1.4.2 and 1.4.3 side by side on the same laptop, with Node 24.14.0, twice. All three produced the same checksum (864579). Medians, in milliseconds:

Test Node 24.14.0 Bun 1.4.2 Bun 1.4.3
Startup 53.7 / 70.4 30.9 / 29.2 28.4 / 26.6
TypeScript file 101 / 140 36.1 / 29.2 31.4 / 27.5
300 tests 358 / 345 63.7 / 88.8 59.2 / 60.9
Sort 2M numbers 1,257 / 2,343 721 / 691 554 / 552
JSON round-trip 150 / 253 163 / 198 141 / 149
Prime sieve 108 / 156 122 / 132 113 / 117

Each cell is round 1 / round 2. 1.4.3 was never slower than 1.4.2, and the conclusions above still hold. The sieve went to Node in round 1 and to Bun in round 2, so treat it as a tie. The two rounds also show how much a busy laptop moves the numbers (Node’s sort took 1.3 s in one round and 2.3 s in the other), which is why only the big gaps count as results.

A second machine: Linux, November 3

To see whether the result was just my laptop, I rebuilt the same kinds of tests (an empty script, a small .ts file, 300 node:test tests, and the three CPU tasks, with matching checksums) and ran them on a 4-CPU GitHub Actions ubuntu-latest machine. These are new scripts written to the same recipe, not the original files, so compare the ratios, not the milliseconds:

Test (median) Node 24.22.1 Bun 1.4.3 Bun 1.4.4
Startup, 30 runs 24.5 ms 5.2 ms 5.4 ms
TypeScript file, 20 runs 70.0 ms 5.4 ms 6.0 ms
300 tests, 7 runs 251.5 ms 43.2 ms 44.0 ms
Sort 2M numbers, 5 runs 1,099 ms 652 ms 655 ms
JSON round-trip of 200,000 objects 212 ms 127 ms 131 ms
Prime sieve to 10 million 50 ms 46 ms 47 ms

Same direction as on Windows, with bigger gaps for startup and the TypeScript file, and the prime sieve again close to a tie. The scripts and the run are public.

How the Windows numbers were measured

  • Same code on both runtimes: the CPU test, the TypeScript file and the 300 tests were byte-for-byte identical. The test file uses node:test and node:assert, which Bun supports.
  • Repeated runs, median reported: startup 30 runs, TypeScript 20, CPU 5 (timed inside the process), tests 7.
  • Startup and TypeScript timings include creating the process, measured from Node’s spawnSync. That’s the time you actually wait when you run a command.
  • The CPU tasks had to agree: both runtimes produced the same checksum, so neither was skipping work.

Limits of this test

  • One Windows laptop with 2 cores. Results on Linux, macOS or a big server can differ, especially for the test runner and HTTP.
  • Micro-benchmarks, not your app. Real apps spend time on I/O, databases and dependencies. Measure your own workload before switching.
  • Bun’s compatibility wasn’t tested here, only speed. Some Node packages and APIs still behave differently on Bun.

— N.K., end of entry No.011

Useful? Pass it on:Post on XFollow @EmotionalMatter

Related entries

  1. No.092

    TypeScript 7.1 beta tested: ts-jest, ESLint, NestJS, Angular

    On TypeScript 7.1.0-beta, ts-jest, typescript-eslint, ts-node and TypeDoc failed exactly as on 7.0, and so did NestJS, Angular, vue-tsc, svelte-check and astro check. The beta does ship a compiler API, but at new entry points (typescript/sync and typescript/async) that no tool uses yet. The side-by-side setup with TypeScript 6 fixed every one I re-ran.

    TESTED4 min
  2. No.067

    bun check vs tsc: TypeScript type-check speed, tested

    On Zod, bun check took 3.7 s against 13.7 s for tsc 7 and 58 s for tsc 6, and printed the same 31 errors as tsc 7, line for line. On Hono, 7 referenced projects, it took 3.8 s against 7.3 s for tsc 7 -b, with nothing built first. The trap: in a project whose package.json has a "check" script, bun check runs that script and never type-checks.

    TESTED4 min
  3. No.029

    TypeScript 7 migration guide: breaking changes, tested

    Every option TypeScript 6.0.3 marked as deprecated was a hard error on 7.0.2, and ignoreDeprecations no longer silences it. Two defaults that arrived in 6.0 (strict on, @types not loaded automatically) also break projects coming straight from 5.9.

    TESTED7 min

tip: paste the exact error text