How much would you get by moving to Go, Rust or C++?
We replaced Node.js with Bun for 5x throughput
21–30 of 36 posts
Re: We replaced Node.js with Bun for 5x throughput
#22It's not about Bun, but more about sqlite and zod replacements. Why interpret this as "Bun is faster"?
Re: We replaced Node.js with Bun for 5x throughput
#23I'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.
Re: We replaced Node.js with Bun for 5x throughput
#24Earlier quoted context omitted.
The bun build creates a large self-contained executable with no optimisations. Almost like a large electron build. Deno also provides the same functionality, but with a smaller optimized binary. Appreciate Bun helping creating healthy competition. I feel like Deno falls under most people's radar often. More security options, faster than Node, built on web standards.
I was curious: $ cat app.ts console.log("Hello, world!"); $ cat build #!/usr/bin/env bash bun build --compile --outfile bun-darwin-arm64 --target bun-darwin-arm64 app.ts bun build --compile --outfile bun-darwin-x64 --target bun-darwin-x64 app.ts bun build --compile --outfile bun-darwin-x64-baseline --target bun-darwin-x64-baseline app.ts bun build --compile --outfile bun-linux-arm64 --target bun-linux-arm64 app.ts bu…
https://github.com/oven-sh/bun/issues/26373
Doc site says: --production sets flag --minify, process.env.NODE_ENV = production, and production-mode JSX import & transform
Might try:
bun build --compile --production --bytecode --outfile myapp app.tsRe: We replaced Node.js with Bun for 5x throughput
#25Earlier quoted context omitted.
The bun build creates a large self-contained executable with no optimisations. Almost like a large electron build. Deno also provides the same functionality, but with a smaller optimized binary. Appreciate Bun helping creating healthy competition. I feel like Deno falls under most people's radar often. More security options, faster than Node, built on web standards.
Ideally we would still only use JavaScript on the browser, personally I don't care about about the healthy competition, rather that npm actually works when I am stuck writing server side code I didn't ask for.
Re: We replaced Node.js with Bun for 5x throughput
#26Earlier quoted context omitted.
I was curious: $ cat app.ts console.log("Hello, world!"); $ cat build #!/usr/bin/env bash bun build --compile --outfile bun-darwin-arm64 --target bun-darwin-arm64 app.ts bun build --compile --outfile bun-darwin-x64 --target bun-darwin-x64 app.ts bun build --compile --outfile bun-darwin-x64-baseline --target bun-darwin-x64-baseline app.ts bun build --compile --outfile bun-linux-arm64 --target bun-linux-arm64 app.ts bu…
Where? bun's doc site search engine doesn't show it but there's an open PR on the topic. https://github.com/oven-sh/bun/issues/26373 Doc site says: --production sets flag --minify, process.env.NODE_ENV = production, and production-mode JSX import & transform Might try: bun build --compile --production --bytecode --outfile myapp app.ts
$ bun build --help | grep Implies
--compile Generate a standalone Bun executable containing your bundled code. Implies --production
$
I actually did double check it though because it used to be wrong. For good measure: $ grep bun build
bun build --bytecode --compile --outfile bun-darwin-arm64 --production --target bun-darwin-arm64 app.ts
bun build --bytecode --compile --outfile bun-darwin-x64 --production --target bun-darwin-x64 app.ts
bun build --bytecode --compile --outfile bun-darwin-x64-baseline --production --target bun-darwin-x64-baseline app.ts
bun build --bytecode --compile --outfile bun-linux-arm64 --production --target bun-linux-arm64 app.ts
bun build --bytecode --compile --outfile bun-linux-arm64-musl --production --target bun-linux-arm64-musl app.ts
bun build --bytecode --compile --outfile bun-linux-x64 --production --target bun-linux-x64 app.ts
bun build --bytecode --compile --outfile bun-linux-x64-baseline --production --target bun-linux-x64-baseline app.ts
bun build --bytecode --compile --outfile bun-linux-x64-modern --production --target bun-linux-x64-modern app.ts
bun build --bytecode --compile --outfile bun-linux-x64-musl --production --target bun-linux-x64-musl app.ts
bun build --bytecode --compile --outfile bun-windows-arm64 --production --target bun-windows-arm64 app.ts
bun build --bytecode --compile --outfile bun-windows-x64 --production --target bun-windows-x64 app.ts
bun build --bytecode --compile --outfile bun-windows-x64-baseline --production --target bun-windows-x64-baseline app.ts
bun build --bytecode --compile --outfile bun-windows-x64-modern --production --target bun-windows-x64-modern app.ts
$ ls -1hs bun*
59M bun-darwin-arm64
64M bun-darwin-x64
64M bun-darwin-x64-baseline
95M bun-linux-arm64
89M bun-linux-arm64-musl
95M bun-linux-x64
94M bun-linux-x64-baseline
95M bun-linux-x64-modern
90M bun-linux-x64-musl
107M bun-windows-arm64.exe
110M bun-windows-x64-baseline.exe
111M bun-windows-x64.exe
111M bun-windows-x64-modern.exe
$Re: We replaced Node.js with Bun for 5x throughput
#27Re: We replaced Node.js with Bun for 5x throughput
#28Re: We replaced Node.js with Bun for 5x throughput
#29I cringed at those "aaa\0bbb\0ccc\0ddd" Map keys. That's much slower than nested maps and requires allocating the strings, giving GC more work to do.
Re: We replaced Node.js with Bun for 5x throughput
#30Earlier quoted context omitted.
Ideally we would still only use JavaScript on the browser, personally I don't care about about the healthy competition, rather that npm actually works when I am stuck writing server side code I didn't ask for.
FE-BE standardization is efficient in terms of labor and code migration portability, but I really like the idea of static compilation and optimization of the BE in production.. there's absolutely no need or reason for the BE to do dynamic anything in prod. As long as it retains profiling inspectability when things go wrong.