logoalt Hacker News

We replaced Node.js with Bun for 5x throughput

39 pointsby pier25today at 1:57 AM20 commentsview on HN

Comments

fleebeetoday at 6:15 AM

I'm puzzled by the title of this post. From what I can gather most, if not all, of the performance improvements came from sacking SQLite and Zod.

They applied optimizations that cut CPU time by ~40% to the Bun version before comparing it with Node. Claiming 5x throughput from "replacing Node.js with Bun" is a wild misrepresentation of the findings.

dcretoday at 4:33 AM

I was curious why bun build --compile would be faster. The docs say:

“Compiled executables reduce memory usage and improve Bun’s start time.

Normally, Bun reads and transpiles JavaScript and TypeScript files on import and require. This is part of what makes so much of Bun “just work”, but it’s not free. It costs time and memory to read files from disk, resolve file paths, parse, transpile, and print source code.

With compiled executables, you can move that cost from runtime to build-time.”

https://bun.com/docs/bundler/executables#deploying-to-produc...

mdavid626today at 5:44 AM

It's not about Bun, but more about sqlite and zod replacements. Why interpret this as "Bun is faster"?

show 1 reply
ksectoday at 4:20 AM

>Next: the runtime itself. Bun has a bun build --compile flag that produces a single self-contained executable. No runtime, no node_modules, no source files needed in the container.

I didn't know that. So Bun is basically a whole runtime + framework all in one with little to no deployment headaches?

show 2 replies
abustamamtoday at 4:44 AM

I use bun for everything except for monorepos with isolated deployment targets and shared packages. I use yarn or pnpm for monorepos. Maybe it's changed in the last six months but I could never get docker to properly resolve my dependencies when I only want to build the web app, for example, since the bun lock is deterministic based off of all the packages in the repo so isolating a single leaf makes it error.

Maybe I'm doing something wrong but I scoured docs and online and asked multiple AI agents to no avail.

azinman2today at 5:31 AM

So is Bun saying that JSC is much better than v8?

show 1 reply
mememememememotoday at 5:25 AM

How much would you get by moving to Go, Rust or C++?

show 2 replies
denys_potapovtoday at 4:29 AM

tl;dr replace SQLite with Map ~ 2x speed up, replace zod validation with ifs ~ 2x speed up. Bun had a memory leak on unresolved promises - now fixed

LeonTing1010today at 4:32 AM

[flagged]