zack
@zack_overflow
Followers
27K
Following
14K
Media
438
Statuses
3K
i like systems programming, prev @bunjavascript
SF
Joined November 2020
Revamped the gratuitous explosions and particle effects to the code editor I'm building And added sound effects! (Sound on!)
1K
4K
42K
I have radial nerve pain everytime I use the macbook keyboard for more than 10 minutes so I need to use the Kinesis Adv360 everywhere I go
1
0
10
Now that I no longer work on Bun and am jobless Who are the most insane programmers in SF that I should meet and vibe with
53
0
582
And by bag I mean the Bun team branded Timbuk2 Division Deluxe 15" Computer Backpack with 18L capacity and durable water repellant finish
9
0
346
I'm super grateful for @jarredsumner for seeing this stupid tweet of mine 2 years ago and taking a bet on me. Literally changed the trajectory of my life. And I continue to idolize and be inspired by him as much as I was when I was a fanboy in 2022 when Bun was just a bundler!
7
4
374
Anyway, I left around mid-October. It had been 2 years and it felt like it was time I did something new. I'm super happy for the team and I think this next chapter for Bun at Anthropic is going to be really, really good for Bun. I literally still use Bun everyday
2
1
247
That's when I knew I was going to be having A LOT of fun I had so much fun banging out Zig code. I can literally close my eyes and almost see the exact lines of code I wrote for Bun.Glob, the shell, the CSS parser, etc. Incredible
1
0
257
Probably a good time to share that I no longer work on Bun anymore! I still remember my first day. I came into the office at 4AM (I was jet lagged). And @jarredsumner was still there and asked me if I wanted pizza. I opened the fridge and there were 4 boxes of pizza...
Anthropic is acquiring @bunjavascript to further accelerate Claude Code’s growth. We're delighted that Bun—which has dramatically improved the JavaScript and TypeScript developer experience—is joining us to make Claude Code even better. Read more:
17
12
1K
In the 1960s, thousands of teenagers ran away from home to go to hippie San Francisco I discovered hundreds of letters written by these teens about what they were going through, hidden in the archives at the SF library Blogpost about the story: https://t.co/sk4W1PCK2H
2
11
132
I go into more detail, talk about implementation details, I even built my own simple template interpreter written in asm and benchmarked it against other styles of interpreters!
1
0
31
Anyway, this thread is getting too long. As you can tell I've nerd sniped myself on this whole topic. I'll tell you one more thing Both V8's and HotSpot's interpreters are known as "template interpreters" and I wrote a blog post on the whole damn topic: https://t.co/rVdNuqzVSe
zackoverflow.dev
A look at an under-discussed style of interpreter used by V8 and Hotspot.
3
5
57
Anyway if you write your interpreter in a low-level language like asm, you can design it to make the swap efficient For example, V8's Ignition interpreter intentionally shares the same ABI as V8's JIT'ed code, so hopping into JIT'ed code is pretty much just a jmp instruction:
1
0
33
On-stack replacement (OSR) is a technique that allows swapping to optimized JIT'ed code in the _middle_ of a function, for example when that hot loop loops around to the next iteration OSR also works for swapping *out* of JIT'ed code, aka deoptimization
1
0
26
But what if you have a function which is not called often (so it's not marked as "hot" and doesn't get JIT compiled) But within that function there is a hot loop? You'd still want the loop to benefit from JIT.
1
0
24
One thing interpeters with JIT compilation need to think about is how and where the interpreter will hop into JIT compiled code The easiest place to do this is at the function boundary: just call into the JIT'ed code.
1
0
27
There's also one more reason to hand-roll a bytecode interpreter in a low-level assembly-like language, and it actually has to do with playing nicely with JIT compilation and something called On-Stack Replacement (OSR)
1
0
28
This might suggest that advancements in compilers have brought the gap closer but I don't have the exact code and I would need to run the benchmark on a 10+ year old C compiler on the same computer
1
0
27
LuaJIT's interpreter is 2x faster. It's hard to tell how much of that difference comes from it being written in asm or some other differences (for example different opcodes) Benchmarks from 10 years ago on the wayback machine show that it was 3.6x faster
1
0
34