Bun v0.2.0
github.com
github.com
https://deno.com/blog/v1.25#new-experimental-http-server-api
I guess this is not being used here?
Edit:
In fact in the HTTP benchmarks Deno seems to be much faster than Bun.
Bun’s http server is single-threaded, single-process right now. I think it’s really important to get single-threaded performance right before concurrency. Bun will eventually support builtin clustering/concurrency but it doesn’t yet
Thats why I hate benchmark by package author/publisher.
edit: as a silly point of reference, an hello world that writes the same headers and the same body on a 2016 intel macbookpro is able to serve 125k rps in bun, 145k rps in deno/flash and 140k rps in nodejs+uws.
On a local 4 core VM, generating the load locally:
Deno.serve() appears to be particularly bad for me at this test until you crank up the concurrent connections (>500) it gets up to 2k rps but it also falls over after that load.
The `react-hello-world.node.js` server in node peaks at about 1.5k rps @ 32 connection
Bun running react-hello-world.jsx gets 8k rps with 32 connections. This uses a customised local copy of `react-dom/server` where [1] at least the `escapeHTML` function is switched for bun's native implementation, and this appears to be packaged (or will be?) with bun [2]. I'm not sure if anything else is different here as the bun packaged code is still minified. The `bench/snippets/react-dom-render.bun.js` [3] test comparing these only show the bun version of `react-dom/server` to be 1.5 - 2x faster on this VM so it appears there is something more to it. Maybe everything `react-dom/server` normally stresses is optimised in bun? or `escapeHTML` is very large on the flamegraph.
Running the react-hello-world.node.js server in bun results in about 1.9k rps @ 32 connection
Running react-hello-world.deno.jsx in bun doesn't work.
Futzing with react-hello-world.deno.jsx to load the cjs react builds will run in bun at about 1.9k rps
0: https://github.com/oven-sh/bun/tree/bun-v0.2.0/bench/react-h...
1: https://github.com/oven-sh/bun/blob/bun-v0.2.0/test/bun.js/r...
2: https://github.com/oven-sh/bun/blob/bun-v0.2.0/bench/react-h...
3: https://github.com/oven-sh/bun/blob/bun-v0.2.0/bench/snippet...
Lies, damned lies, and benchmarks.
If it really is a problem, then a binary lockfile might be worth it, but it's a pretty substantial hit to developer experience, I think. At least, I'm accustomed to checking the lockfile diff on PRs, and it's a shame to lose that.
To make serialization fast though, it would still need to do structure of arrays instead of an array of structures. Instead of each package being an object in the lockfile, arrays of package names, of version numbers, etc. it would need a tool to understand it
Currently writing a small Zig project, I can totally see that. Although frankly I will probably stick to Go. Zig is a lot more work in my view as it os very low level. However that is also what helps you squeeze out performance.
With Zig you really get a fine grained control of memory management and it is a lot easier to push anything you can to be computed at compile time rather than runtime.
As for Rust and Zig, IMHO, programming in Zig is more fun, so if I was OP, I'd also have gone for Zig.
I have some criticism for the language itself around personal preferences, such as "concepts need to be finished ASAP", "don't depend on libc" (Zig is doing a much better job here) and some syntax pet-peeves.
Nim needs to be more popular IMO. Well, the same goes for D too. Sigh.
1. Support for cyclic imports 2. Official WASM support. I know nlvm exists. But those are two separate runtimes to be managed for long time.
I was writing a compiler I remember where I hit the 5k LOC mark in Nim. And then the errors and stuff. It was a terrible experience putting all the types into one file, the functions into others etc etc. The DevExp is bad that way.
Other than that, I don't see much issues with Nim to be fair. Its quite a good language that ticks all boxes
Some problems are - vibe.d does not look nearly as performant or supported as, say, Drogon, which is what I was seriously considering using (I love the idea of using C++ with modern move semantics and coroutines to make async code easy).
I know and love Java and Node a lot - just want to try not using a VM for a bit :)
How much of this is due to Zig, vs using Webkit instead of v8?
Please take a look at #1169. This stopped me, and the issue got a couple agreements. Also asked around on Discord to no avail. I see you have #156, which seems to indicate you're able to bundle, just not optimally for prod. But it's not clear to me how to generate a bundle.js for a main entrypoint.
Maybe just a doc issue? Running ./node_modules.bun gets a loadable module, but unclear where to go from there and it's not drop-in compatible with my esbuild process.
If need to change my existing code, I might as well switch over to a much more mature runtime like Deno
I was pretty excited when I saw the initial release but that entire ordeal torpedoed my interest. If you're a startup and looking for someone to dedicate their life to you, you're looking for a co-founder, not a salaried employee. We've seen what happens to infrastructure startups with zealous employees with npm Inc, we don't need a repeat of that.
EDIT: I was trying to find the original tweets by the company but it looks like there are only quote-retweets talking about it left as the originals have been deleted.
It could have been much worse if these expectations were found out after joining.
And this is not actually known before joining. At least bun says that outright.
Some people actually don't mind working hard unlike others if things are interesting. Not everyone is the same. There is certainly more fun working on bun out in the open than solving some random bug in Netflix, Amazon without even being noticed. And with forewarned warning.
I get this error:
./build.zig:254:17: error: no member named 'isAARCH64' in enum 'std.target.Arch'
if (arch.isAARCH64()) {
^
/usr/lib/zig/std/special/build_runner.zig:170:24: note: referenced here
.ErrorUnion => try root.build(builder),
^
make: *** [Makefile:1010: dev-obj] Error 1https://github.com/oven-sh/zig
It can be built, but you will also need to compile JSC from bun’s WebKit repo https://GitHub.com/oven-sh/WebKit