Top
Best
New

Posted by gr4vityWall 4 days ago

Bun has an open PR adding shared-memory threads to JavaScriptCore(github.com)
145 points | 310 commentspage 2
bakugo 4 days ago|
I like how the page is actually struggling to load due to the sheer amount of bot activity on the PR.

On a completely unrelated note, I wonder why Github is always down. Real mystery there.

roblh 3 days ago||
Putting on my tinfoil hat. Did Anthropic even buy Bun because they actually use it or was it just an excuse to lob ridiculous PRs at things with at least a little bit of credibility behind them. Their way of trying to set a precedent for accepting AI code into bigger open source projects.
rzmmm 3 days ago|
The author has huge online following, and influence over developers. I don't doubt the author is genuinely interested in this, but the employer definitely is supporting this too.
JamesSwift 4 days ago||
Ive said many times in my day-to-day convos around AI that Ive come to realize more and more that AI is a solo endeavor. Its very difficult to scale things to more people if you are trying to use AI for more than just speeding yourself up.

AI is the epitome of the saying "if you want to go fast, go alone". This PR and the rust rewrite are incredible in scale and ambition. I still think theres a middle ground though of traditional committee-driven design with AI-driven iteration and POCs.

anematode 4 days ago||
This is terrifying. Evidently based on prior art by Mr. Pizlo – indeed, where's the acknowledgement of that?? (edit: I missed it) – but I'm assuming that was never translated into code.

I love the idea of experimentation and innovation; I abhor the idea of it being dependent on Anthropic and their theft. I've never rooted for the Chinese labs more strongly than after seeing this.

bojan 4 days ago|
The acknowledgement is in the PR description, section "The design, and what it's based on".
anematode 4 days ago||
Thanks, fixed
quotemstr 4 days ago||
I know a thing or two about VMs. Reading this post, I thought to myself "No way it was this easy. No performance hit in the single threaded case? No way".

I was right. Buried in the middle of the post is this tidbit:

> v1 collects synchronous and stop-the-world

Ah, there it is! I knew it!

Parallel garbage collection is a very hard problem. Years of experience and subtle implementation are required to get something like ZGC. A stop-the-world garbage collector will kill tail latency in many use-cases, especially for large programs. I'd say a good GC is the hardest part of a modern VM, even harder than a good JIT: not that a JIT is easy.

Show me multi-threaded JS with generational mark, sweep, compaction, etc. running in parallel with the mutator and I'll be impressed. (The smart thing would be to base it on the JVM or CLR. Doesn't count though.)

It's all so exhausting, this current programmer culture of doing the easy part of a system thing X and presenting your work, without qualifiers, as a complete and modern X.

Sure, sure, we can have memory safe C (just don't have any data races!). Sure, we can have an AI C compiler (just don't expect type checking). Sure, we can port SQLite to Rust (but don't expect it to be fast). Sure, you can one shot a Slack clone (just don't expect performance or security). Doing the easy part of a thing is not doing the thing! You can't trust a README's feature list these days.

To be fair, given that the README is obviously unedited LLM output, the authors might not have realized that their agents cheated and made threading easy by pessimizing the GC. The LLM certainly did though.

Now, maybe the JSC really is adaptable to a multi-threaded mutator world. If it is, great. But over and over, I've seen AI say "I will defer and charter $HARD_THING" and mean "I have no idea how to do $HARD_THING, so I'm creatively reinterpreting your request to make it easy". You have to be endlessly vigilant for LLMs subtly twisting your tasks into easy versions that might technically meet the requirements but they are less complete than you intend.

hedgehog 4 days ago||
I sometimes wonder if full GC is really worth it. For a lot of applications some compile time analysis + refcounting is close enough, and for some others arenas (per frame rendered, per request served, etc) are as fast as a GC to allocate and faster than malloc to free. Could we make the rest a compile error and save most people most of the time a lot of pain?
quotemstr 4 days ago||
GC is worth it. What you're proposing is a false economy.

In addition to lifetime management, GC gives you compaction, pointer compression, and fast bump-pointer allocation that doesn't depend on being able to represent your lifetimes as nested arenas.

Modern GC is excellent. Replacing it with manual allocation isn't better, even with guardrails: reference counting is expensive, atomic reference counting doubly so, and free() itself is very far from free.

Sure, you can restrict lifetime shapes, but when you do that, people switch to allocating out of arrays and using indices as pointers, so you're right back where you started with respect to lifetime management.

So what are you saving? You're just replacing the high-performance concurrent mark/sweep microsecond-pause GC someone has written and debugged for you for free with custom convoluted logic that'll probably leak and run slower besides. Why would anyone want this trade?

The elevation of manual memory management to standard performance practice is a generational mistake this industry is making.

hedgehog 4 days ago||
How modern is modern, and who's implemented it? In recent memory (last decade or so) I've had to work around the GC by doing exactly what you describe with arrays as well as off-heap storage to avoid memory footprint and pause issues across Java, Go, and Javascript. Writing something like say Objective C (with its refcounting, autorelease pools, etc) seemed pretty productive, had predictable behavior, etc. I follow GC development a bit, and often cite some of the stuff Gil Tene has written as an example of clear technical writing and thinking, but I'm not convinced GC is that universally good. Rust's approach has a high ergonomics cost but the Swift people seem to get by.
12_throw_away 4 days ago||
In contrast, I don't know that much about VMs.

But if you're making a big fundamental change to a system, I do know that it shouldn't start with a single "+279,276 -4,272" PR. It starts with a small patch with the core of the change so that everyone can understand what it does and how it works. (I mean, ideally, a change like this starts with documentation, discussion, diagrams, surveys of existing implementations, etc, before you start writing code)

You don't cram everything into a single 270K line PR, even (especially) with an LLM, unless you specifically don't want anyone else to look too closely at what you did.

emilfihlman 4 days ago||
I would just like to point to a single issue that has major ramifications in using Bun:

https://github.com/oven-sh/bun/issues/14144

piterrro 4 days ago||
think of all the poor web devs trying to use multiple threads on top of asynchronous operations. wild.
hexasquid 4 days ago|
Standard contempt for web developers.
JCTheDenthog 4 days ago|||
[flagged]
curtisblaine 4 days ago||
Worth noting it's not web devs pushing for React in the Windows start menu. It's PMs looking at the problem and concluding React is the least painful way to solve it (correctly or incorrectly, but I doubt they optimize for the same measurements you do).

Ink (the React renderer) in Claude code, on the other hand, makes a lot of sense for interactive CLIs where you want to componentize your menus and dialogs. Actually not using a component framework normally ends up in state / render chaos.

Re: mayflies debating politics: React has been there for 13 years, and while the interface has shifted a couple of times (object factories to classes to functions), the main idea has always been really simple and really stable: isolated declarative components that can optionally have state and side effects. Many other popular frameworks have come and gone in the meantime.

adem 4 days ago||
I will never get over the overuse of adjectives like "real" in LLM outputs, it dilutes the meaning of these words.
Nnnes 4 days ago|
Related, spinning "I did something poorly" into "I am being honest"

> Scalability, measured (the honest section)

so what about the other sections?!

fzzzy 4 days ago||
The dishonest sections
tomjakubowski 4 days ago||
For what it's worth: this isn't a PR on mainline WebKit. The PR is on bun's own fork of WebKit (and JSC), which already has a bunch of their own changes.
mirekrusin 4 days ago|
Did they rewrote WebKit in Rust or not yet?
anematode 4 days ago||
I'd actually love to see a relatively high-performance (i.e., including a decent JIT) runtime for a dynamic language that's written in Rust. There's a lot of implementations like Rust Python, the Boa JS engine, etc. that are purely interpreted – and fun! – but I haven't seen a proper, high-performance VM yet.

I considered writing such a JVM in Rust, following writing one in C (https://github.com/anematode/b-jvm) that could JIT WebAssembly code and run in the browser, but decided it would be too time-consuming.

Obviously such a VM would involve a lot of unsafe, but I'm wondering if you could establish some proper, compile-time-checked invariants that make things a lot safer, without the complicated sandboxing that modern JS runtimes use to make it harder for JIT bugs to escalate into full blown RCE.

jitl 4 days ago||
rust seems alergic to the un-safety required of "i dynamically built this executable code segment just now, please jump into it"
tomjakubowski 3 days ago|||
This is wrong, demonstrably. There are multiple OS kernels written in Rust (with small amounts of ASM glue, as is required in any kernel project).
anematode 4 days ago|||
wasmtime exists
jitl 4 days ago||
yes i love to use a language runtime within another language runtime for a sweet sweet 30% performance penalty
anematode 4 days ago||
Why the snark? wasmtime is a (pretty popular) Rust project which uses a JIT, demonstrating that it's not incompatible with Rust. Obviously a proper VM wouldn't depend on wasmtime, but implement its own JIT and paraphernalia.
jitl 4 days ago||
fair. i guess i used “rust” in collective noun sense for “rust the ecosystem and community”; from my armchair experience there’s a big contingent of that community that abhors unsafe and software that uses it, and it’s that community/ecosystem aspect that prohibits unsafe since of course the language and compiler support it just fine.
tomjakubowski 3 days ago||
The community does not abhor use of unsafe. The community abhors bad usage of unsafe: unsafe code should be used only when necessary, and ideally to build safe abstractions.
nozzlegear 4 days ago|
> Scalability, measured (the honest section)

Barf

moogly 3 days ago|
Heh, are the other sections dishonest, then? Yuck.
More comments...