An early preview of experimental Bun + JSC with ahead-of-time compilation

For Claude Code's CLI: 24% faster startup, 48% lower memory, 46% lower CPU, and nearly 2x larger binary size

Sep 29, 2026 · 1:06 AM UTC

69
65
1,376
146,141
Replying to @jarredsumner
Most JavaScript usage is just-in-time compiled.

As code runs, types of values are watched and when a function runs frequently enough, a faster specialized version of that function is compiled on-demand.

Ahead of time compilation bakes that work into the executable itself.
1
1
167
12,522
Replying to @jarredsumner
The cost of ahead-of-time compilation is less information about the types is available.

In native languages like Rust or Go, numbers specify double or int, a sign, and a size.

TypeScript is more flexible and less specific, which makes performance optimizations harder.
6
1
130
8,869
Replying to @jarredsumner
In this prototype, a limited amount of TypeScript syntax is used to propagate type information.
2
1
79
6,923
Replying to @jarredsumner
Generally, ahead of time compilation results in slower peak JavaScript execution than just-in-time compilation.

We think a stricter flavor of TypeScript and locking down modifications to builtins like Array & Object can close most of the gap.
4
0
87
10,142
Replying to @jarredsumner
There are a lot of optimizations that aren’t implemented yet.

I want the binary size growth to go down a lot more (it started at 1 GB).

It needs to support sized types like uint32_t and propagate more detailed types.

There’s no separate checker to run and no diagnostics
3
0
62
6,886
Replying to @jarredsumner
AoT uses Bun’s bundler & parser to parse typescript, tags types to JavaScriptCore via a typecheck bytecode intrinsic, and compiles the bytecode to machine code via B3 (what JSC’s JITs use)

This keeps the JavaScriptCore changes well-contained, so that syncing with upstream WebKit isn’t complicated
1
0
66
6,423
RepliesRelevant
Your burger opinions are valid. Mostly. Prove it in a short survey. $5 reward for eligible participants who complete it.
0
3
22
146,466
Replying to @jarredsumner
@jarredsumner what happens when a baked in type guess is wrong at runtime
1
0
5
2,434
Replying to @jeremybosma_
@jeremybosma_ throws a TypeError
1
0
10
2,439
Replying to @jarredsumner
@jarredsumner @sseraphini Do you plan on supporting direct FFI with this? As in, link a C function?
0
0
7
1,041
Replying to @jarredsumner
@jarredsumner 24% faster startup and 48% lower memory usage is a serious improvement.
0
0
4
1,272
Replying to @jarredsumner
@jarredsumner bin size is not a big problem tho
1
0
2
1,062
Replying to @jarredsumner
@jarredsumner Just rewrite Claude Code in a real language already
1
0
15
1,527
Replying to @jarredsumner
@jarredsumner With Perry we did that a few months ago: x.com/realamlug/stat…

Been optimizing ever since, and the latest main of Perry gets it really performant. Post coming soon about that. :)

But glad to see everyone is now trying to compile JS/TS.
A month ago, I pointed Perry at the 13 MB minified cli.js that npm ships for Claude Code and asked for a native binary.

No Node. No JIT. One executable.

It logs in, streams a real answer, exits clean.

160 compiler bugs later.
0
0
9
1,501
Did you run a company that’s no longer operating?

micro1 is looking to acquire anonymized operational data from US-based companies that had 25+ employees at their peak.

Eligible partners can receive up to $2M per data package.
32
62
535
1,768,331
Replying to @jarredsumner
@jarredsumner Experimental means he’ll merge it in two weeks
0
0
9
500
Replying to @jarredsumner
@jarredsumner This is the way. I have been playing around with something similar I called ChadScript, an AOT-compilable subset of TS. The Bun version will be a game changer though, nice work. cs01.github.io/ChadScript/
1
0
3
1,752
Replying to @jarredsumner
@jarredsumner Bun 披露与 JavaScriptCore 的实验性提前编译:Claude Code 命令行启动约快 24%,内存约降 48%,CPU 约降 46%,代价是二进制体积接近翻倍。代理工具一天要冷启动很多次,运行时税会进总账单;用体积换冷启动,是在给高频命令行代理重新定价。
0
0
1
1,531
Replying to @jarredsumner
@jarredsumner I didn't understood the 2x binary size. Can Anyone explain that?
1
0
1
1,206
Replying to @jarredsumner
@jarredsumner drop the "script". just "java". cleaner that way.
0
0
3
360
Replying to @jarredsumner
@jarredsumner Thanks to Jarred, JavaScript is now real Java.
1
0
2
383
Replying to @jarredsumner
@jarredsumner That binary size is insane. Definitely has to go down.
0
0
1
340
New online course with Dr. Rossella E. Nappi. Menopausal vasomotor symptoms.

Register for free.
0
2
12
102,758
Replying to @jarredsumner
@jarredsumner ****48% less memory?! ******
1
0
2
261
Replying to @jarredsumner
@jarredsumner 为了跑一个 agent 客户端 现在要背这么大的运行时
有人开始从底层抠内存和启动时间
说明工具重得已经不像工具了
0
0
1
727
Replying to @jarredsumner
@jarredsumner I'm curious what happens to stuff like "const a: any = JSON.parse(...)". I mean how could this possibly be optimized, there is zero knowledge about anything.
1
0
1
1,252
Replying to @jarredsumner
@jarredsumner does it do "max optimize everything"?
but due to the dynamism of JS that may be pretty hard, bytecode was a great and cheap step, going further requires some assumptions I believe
0
0
1
279
Replying to @jarredsumner
@jarredsumner @bunjavascript Imagine a world where this gets merge into WebKit/JSC
0
0
1
292
Replying to @jarredsumner
@jarredsumner how are you getting the compiled code into the binary? is it unlinked FTL? this whole unlinked JIT code stuff in jsc seems interesting
0
0
0
80
Replying to @jarredsumner
@jarredsumner we truly are living in a renaissance
0
0
0
147
Replying to @jarredsumner
@jarredsumner Lo vi hoy claude code ya usa bun 1.4.3
0
0
0
760
Researchers are conducting a study to understand how to prevent suicide among Black LGBTQ young people. If you qualify, you will be invited to take a 45-minute online survey every 3 months over 18 months. Eligible participants receive $30 gift card for each survey completed.
37
65
1,138
4,550,244
Replying to @jarredsumner
@jarredsumner How does this differ from the existing compile parameters in bun?
1
0
0
947
Replying to @jarredsumner
@jarredsumner Is it statically inferring types on the JavaScript?
0
0
0
542
Replying to @jarredsumner
@jarredsumner What kind of optimization pipeline bun AOT is currently using? Are the types from typescript hints are being used or this is coming from "js" again? Does it do something like HarmonyOS do for arkts?
0
0
0
459
Replying to @jarredsumner
@jarredsumner AOT is experimental or something readily available GA?
0
0
0
384
Replying to @jarredsumner
@jarredsumner It does look promising, but +80% in size is a little too much IMO 👀
0
0
0
67
Replying to @jarredsumner
@jarredsumner How about hybrid aot-jit like android runtime? Of just transpile typescript to pure aot lang that already has years of optimization? Or to llvm ir directly? Anyone just use static type plugin anyway (typescript), so remove dynamic typing entirely
0
0
0
2,133
Replying to @jarredsumner
@jarredsumner This working, will make me move my code from Node to Bun. Wonder if you could get better perf by switching to v8.
0
0
0
499
Earn up to 5.00% APY* with Axos ONE®. That’s 13x more money back than an average bank. You do the math.
11
23
311
936,311