YouTube Summaries

← All summaries

scriptc compiles TypeScript to C, big memory wins

2026-08-19 Wed ⏱ 12 min theprimeagen

Prime benchmarks scriptc (vercel-labs), which compiles TypeScript to either a debuggable C backend or LLVM IR and then to a static binary via clang. Memory and startup time drop by roughly an order of magnitude versus Node and Bun; throughput on a real workload is indistinguishable. He is not calling it production ready, but the direction excites him - and he notes why Vercel would fund it.

Tests

Four experiments across Node 26, Bun and scriptc, reported as quantiles (P10 through P99) of VmRSS:

  1. Minimum memory - while(true) with no allocation.
  2. Allocate a million objects.
  3. Startup time - start a one-endpoint server, measure until a TCP connection succeeds.
  4. A rehydrated old benchmark: a 60-tick-per-second server-side game with two WebSocket players shooting at each other, run at 800, 1200 and 1600 concurrent games.

The first three deliberately favour serverless-shaped concerns (cold start, memory) - exactly what matters to Vercel. The fourth is deliberately unrepresentative of typical JS work, which is aggregating Redis/database calls and rendering.

Results

  • Minimum memory (P10): Node ~70 MB, Bun ~40 MB, scriptc 2.2 MB. Percentiles barely move for any runtime.
  • One million objects: Node 259-265 MB, Bun 176 MB, scriptc 88 MB.
  • Startup: Node ~56 ms, Bun ~15.8 ms, scriptc ~2.3 ms.
  • Game, P50 VmRSS at 800/1200/1600 concurrent games: Node 170/222/228 MB, Bun 131/132/140 MB, scriptc 30/44/58 MB. CPU performance was indistinguishable across all three - he suspects pinning to one core with constrained memory would have separated them.

Why the memory drops

Because scriptc has the TypeScript declarations, it emits the object type as a real C struct with concrete field types rather than a V8 object. The particle type in his test compiles to a 72-byte struct against roughly 140 bytes in V8 (~88 in JavaScriptCore). It also uses reference counting rather than garbage collection.

Take

Caveats: the test program is tiny and statically compilable, so real applications will look different. Still, he keeps returning to the hope that this line of work eventually stops Electron apps from eating 1-10 GB each - and credits Vercel for a genuinely interesting direction, unlike their earlier language Zero which he mocked.