Skip to main content

01 - Bun vs Node vs Deno: Three Measurements and Permissions

Three repeatable measurements on Bun, Node and Deno (startup, Response creation, TypeScript) and permissions: what they prove, what they do not, how to choose.

What do you think about this article?

01 - Bun vs Node vs Deno: Three Measurements and Permissions
Bun Runtime 2027Photo:Ruben BoekelooPexels

At a Glance

Three repeatable measurements on Bun, Node and Deno (startup, Response creation, TypeScript) and permissions: what they prove, what they do not, how to choose.

Bun, Node and Deno: what you can really measure, and what you cannot

If you search for "Bun vs Node" you find tables with double-digit advantages and no indication of what was actually measured. This article does the opposite: every number you read came out of a listing you can rerun, on a declared machine, and next to every number you find what it does not prove. The short answer is that none of the three runtimes wins everywhere: Bun starts sooner and creates Response objects faster, Node remains the reference for compatibility and for how teams already know it, and Deno is the only one of the three that by default does not let you touch disk and network without asking.

The measurements were taken on a laptop with an AMD Ryzen 5 5600H CPU (12 logical threads) and 30 GB of RAM, with Bun 1.4.4, Node.js 24.11.0 and Deno 2.6.8, in November 2026. They are three small, deliberately synthetic programs: they help you learn how to reason, not decide in your place. If you have to choose for a real project, the last step is always to measure your workload. The other articles in the series go into the details: migrating from Node to Bun, built-in SQLite and Redis, an API with Hono and the production release.

What is underneath: a different engine, not a faster version of Node

Node and Deno run JavaScript with V8, the Chrome engine. Bun uses JavaScriptCore instead, the Safari engine, and its introductory page states this together with the language the runtime is written in, which today is Rust. It is not a detail for the curious: a different engine optimizes differently, has different startup times and sometimes behaves differently on edge cases. That is why compatibility with Node is a promise to verify on your own code, not an established fact, and the second article in the series devotes space to it.

Deno, in its Node migration documentation, now states that it also reads package.json and npm packages, so the starting distance between the three is much smaller than a few years ago. What remains different is the execution philosophy, which we will see in the section on permissions.

Measurement 1: how long it takes to start

Startup matters where processes are born and die often: command-line tools, CI scripts, functions that spin up on every request. The listing launches a script that prints one line and nothing else, thirty times per runtime, and reports median, minimum and maximum of the wall-clock time measured from outside with time.perf_counter. Measuring from outside includes everything: loading the executable, initializing the engine, reading the script and shutting down. The median is preferable to the mean because a single start slowed down by the operating system does not move the result.

avvio.py (run with python3, next to vuoto.js)
import subprocess, statistics, time, sys
B="bun"; D="deno"
cmd={"bun":[B,"vuoto.js"],"node":["node","vuoto.js"],"deno":[D,"run","vuoto.js"]}
N=30
for name,c in cmd.items():
    ts=[]
    for _ in range(N):
        t=time.perf_counter(); subprocess.run(c,stdout=subprocess.DEVNULL,check=True); ts.append((time.perf_counter()-t)*1000)
    ts.sort()
    print(name, "median %.0f ms"%statistics.median(ts), "min %.0f"%ts[0], "max %.0f"%ts[-1])

# Output:
# bun median 14 ms min 13 max 20
# node median 23 ms min 21 max 35
# deno median 37 ms min 33 max 50

The three numbers are medians in milliseconds. Repeating the test twice in a row Bun stayed between 13 and 14 ms, Node between 23 and 25 ms and Deno between 37 and 48 ms: the order did not change, but the absolute values did, which is why they must be read as orders of magnitude and not as constants. The machine was also under load from other processes while I measured (load average 4.4 on 12 threads), so take the numbers as indicative. Note that Deno turned out slower than Node on this test, the opposite of what is often read. I cannot tell the reason without a profile: it might depend on the permission check and the startup module, but that is a hypothesis, not a measurement. A difference of twenty milliseconds on a process that lives for hours counts for nothing; on a function invoked a million times a day it starts to weigh.

Measurement 2: how much work per request, without the network

The HTTP benchmarks found around mix three things: the server, the load generator and the local network. To avoid attributing to the runtime what is not its own, here I measured only the layer the three have in common, that of the Web standard: a function that receives a Request and returns a Response, called directly in a loop. It is exactly the shape of the fetch handler that Bun, Deno and frameworks such as Hono expect, and it opens no port.

handler.mjs (same file for the three runtimes)
// Measures only the "Request -> Response" layer, without the network
const runtime = typeof Bun !== "undefined" ? `bun ${Bun.version}`
  : typeof Deno !== "undefined" ? `deno ${Deno.version.deno}`
  : `node ${process.versions.node}`;

const handler = (req) =>
  new Response(JSON.stringify({ ok: true, path: new URL(req.url).pathname }), {
    headers: { "content-type": "application/json" },
  });

const req = new Request("http://localhost/ping");
const loop = async (n) => {
  for (let i = 0; i < n; i++) {
    const res = await handler(req);
    await res.text();
  }
};

await loop(20_000); // warm-up, excluded from the measurement
const N = 200_000;
const t0 = performance.now();
await loop(N);
const ms = performance.now() - t0;
const rss = typeof Deno !== "undefined" ? Deno.memoryUsage().rss : process.memoryUsage().rss;
console.log(JSON.stringify({ runtime, requests: N, ms: Math.round(ms), perSecond: Math.round(N / (ms / 1000)), rssMB: Math.round(rss / 1048576) }));

// Output:
// {"runtime":"bun 1.4.4","requests":200000,"ms":183,"perSecond":1094520,"rssMB":41}
// {"runtime":"node 24.11.0","requests":200000,"ms":1572,"perSecond":127237,"rssMB":83}
// {"runtime":"deno 2.6.8","requests":200000,"ms":340,"perSecond":588950,"rssMB":69}
// {"runtime":"bun 1.4.4","requests":200000,"ms":195,"perSecond":1026814,"rssMB":41}
// {"runtime":"node 24.11.0","requests":200000,"ms":1794,"perSecond":111487,"rssMB":84}
// {"runtime":"deno 2.6.8","requests":200000,"ms":362,"perSecond":552104,"rssMB":67}
// {"runtime":"bun 1.4.4","requests":200000,"ms":183,"perSecond":1095787,"rssMB":40}
// {"runtime":"node 24.11.0","requests":200000,"ms":1616,"perSecond":123740,"rssMB":82}
// {"runtime":"deno 2.6.8","requests":200000,"ms":351,"perSecond":569343,"rssMB":66}

The file recognizes the runtime from Bun, Deno or from the versions in process, runs 20,000 warm-up iterations that do not enter the count, then 200,000 measured iterations, and for each one it builds the response and reads its body with await res.text(): without that read you would only measure the creation of the object, not the work on the content. The nine lines are three repetitions per runtime. On this machine Bun completed the 200,000 iterations in about 185-195 ms (about 1.1 million per second), Deno in 340-360 ms and Node in 1,570-1,800 ms, with resident memory at the end of the test of about 40-41 MB for Bun, 66-69 MB for Deno and 82-84 MB for Node.

What it says and what it does not. It says that the Response and Request implementation of Bun is much cheaper than that of Node 24 in this loop: it is a reproducible fact. It does not say that a Bun server handles ten times more requests than a Node server, because in a real application HTTP parsing, the network, the database and your logic weigh in, and in the loop they do not exist. I did not measure a listening server: if you want that number you have to redo it with a load generator on your service, and declare how you did it. Another caution concerns memory: it is the value at the end of the test of a process that has just run a loop, not the peak under real load.

Measurement 3: running TypeScript without compiling it first

Until recently "native TypeScript" set Bun and Deno apart from Node. That is no longer true: the Node documentation reports that type stripping, that is removing the type annotations before execution, is enabled by default from version 22.18 and no longer emits the experimental feature message. I verify it with an arbitrary file.

tipi.ts
interface User { id: number; name: string }
const u: User = { id: 1, name: "Ada" };
console.log(`${u.name} (${u.id})`);

// Output:
// bun:  Ada (1)
// node: Ada (1)
// deno: Ada (1)

The same file runs everywhere with the single command runtime-name file.ts. The word "stripping" is precise, though: Node deletes the types and nothing else, so the TypeScript syntax that produces code, such as enum, is not supported. The second listing shows it.

enum.ts
enum Color { Red, Green }
console.log(Color.Green);

// Output:
// bun:  1
// deno: 1
// node: SyntaxError [ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX]: TypeScript enum is not supported in strip-only mode

Bun and Deno print 1, the index of the enum, because they transform the code instead of merely removing the types. Node stops with ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX and the message says "strip-only mode": for constructs that generate code there is the flag --experimental-transform-types, described on the same page. If your project uses enums or namespace, this is the first thing to check before saying that "Node runs TypeScript".

Then there is the most widespread misunderstanding, which none of the three runtimes solves on its own: running a .ts file does not mean checking its types. The following listing assigns a string to a variable declared number.

errore-di-tipo.ts
const n: number = "I am not a number";
console.log(typeof n);

// Output:
// bun:  string
// node: string
// deno run: string
// deno check:
// TS2322 [ERROR]: Type 'string' is not assignable to type 'number'.
// const n: number = "I am not a number";
//       ^
//     at errore-di-tipo.ts:1:7
// error: Type checking failed.

Bun, Node and Deno run the file without complaining and print string: the types were discarded, not verified. Only deno check, which applies the real TypeScript compiler, reports the TS2322 error and fails. In a serious project the type check should therefore be kept as a separate step in CI (tsc --noEmit with any runtime, or deno check), regardless of who runs the code.

Permissions: the one difference that changes how you design

Deno was born with the idea that a program should not be able to read your disk or open a connection unless you have granted it: its documentation presents it as "secure by default". For a few versions now Node has had a permission model too, stable from 22.13/23.5, but it is opt-in: it starts only if you pass --permission. Bun, in the pages I consulted, has none. The test script reads a file with readFileSync.

test session: the same leggi.mjs with the three runtimes
$ deno run leggi.mjs
error: Uncaught (in promise) NotCapable: Requires read access to "vuoto.js", run again with the --allow-read flag
$ deno run --allow-read=vuoto.js leggi.mjs
19 bytes read
$ node --permission leggi.mjs
Error: Access to this API has been restricted. Use --allow-fs-read to manage permissions.
$ node --permission --allow-fs-read="$PWD" leggi.mjs
19 bytes read
$ bun leggi.mjs
19 bytes read

With Deno the first run fails with NotCapable and says which permission is needed; with --allow-read=vuoto.js I grant reading of that single file and it works. With Node, --permission blocks the API until I add --allow-fs-read. Bun reads without asking anything. The practical advantage is concrete when you run code you did not write: a script from a tool, a suspicious dependency. Knowing that it can read only one folder and talk only to one host limits the damage of a compromised dependency. It is not complete isolation (with broad permissions the advantage disappears), but it moves the default from trust to suspicion.

How to choose, with the criteria in the order in which they weigh

The measurements above have a moral: the speed advantages exist and are large in the edge cases (startup, response creation), but they are rarely the bottleneck of an application that talks to a database. To decide it is better to start from the cost of the change and not from the benchmark.

  • Compatibility of your code: if you depend on compiled native addons or on tools tied to Node, every other consideration comes after.
  • Team skills: a runtime the team already knows is diagnosed faster when something goes wrong at night; a new one has a learning cost.
  • Frequency of starts: scripts, CLIs and on-demand functions gain from a faster start; a service that stays up for weeks does not.
  • Security posture: if you run third-party code, the permission model of Deno or of Node with --permission deserves a trial.
  • Included tools: Bun ships a package manager, test runner and bundler; Deno a formatter, linter and test runner; with Node you choose and assemble them yourself.

The order is not random: the first two criteria are almost always decisive and cannot be measured with a benchmark, the last three shift the judgment only when the others are equal. In practice: stay on Node when the cost of a surprise exceeds the advantage, try Bun on a new service or on an isolated tool where you can go back, use Deno when permissions or the built-in type checking are the reason you choose it. There is no choice that is valid for everyone and forever.

Frequently asked questions

Is Bun faster than Node?

In the two measurements of this article yes, and by a lot: a startup around 14 ms against a median of 23-25 ms, and a loop of 200,000 Response constructions that Bun finishes in about a tenth of the time Node takes. But they are synthetic measurements on a single machine. How much this translates into speed for your service depends on how much of a request's time lies in the runtime and how much in the database and the network, and only a test on your workload tells you.

Can I run TypeScript with Node without a compiler?

Yes, for TypeScript that reduces to JavaScript plus annotations: Node 24 removes the types and runs. enum and the other constructs that generate code do not work, unless you use the experimental transform flag. In no case are the types checked: you still need tsc --noEmit or deno check.

Which runtime is the safest?

None is secure by construction: Deno has permissions active by default, Node offers them on request, Bun does not document them in the pages consulted. Permissions limit what a script can do, but they do not replace the review of dependencies or updates.

What you can do now

You can measure the startup of a runtime from outside with a median and not with a single run, you can isolate the cost of the Request/Response layer from the network, you can check whether a TypeScript file will run with type stripping or will require a transformation, and you know when a denied permission is the protection working. Above all you know what a number does not prove, which is what makes a benchmark honest.

Sources

Commenti

Caricamento commenti...

Sign in to comment

New articles and tools on Telegram too

The Telegram channel flags the site's new articles and tools.

Did you like this article?

Explore other content on the blog or discover my projects