Asm.js Predicted JS's Demise – Wasm Partially Delivers
Gary Bernhardt's 2014 talk foresaw JavaScript killing itself via Asm.js, a typed subset enabling any language in browsers; Wasm advances this but AI code generation has delayed full adoption.
Asm.js Unlocks High-Performance Non-JS Code in Browsers
Asm.js, a strict typed subset of JavaScript acting as web assembly, allows compiling C/C++ or other languages directly to browser-executable code. Every operation explicitly coerces types (e.g., function square(x) { x = +x; return x * x; } becomes a single mul instruction via JIT optimization). This enabled demos like Unreal Engine 3 running at playable frame rates (not 60 FPS) in Firefox in 2013, outperforming pure JS in Chrome. Bundles reached 3MB, feasible despite slower internet and VMs then, proving you could run complex apps like games without native JS. Gary Bernhardt demonstrated Chrome (compiled to Asm.js) running inside Firefox via Wine and X Windows shims, all from C – showing 'if it compiles to C, it runs in the browser.' The core claim: Asm.js lets developers ditch JS for preferred languages while still targeting JS engines, dooming JS dominance.
2025 Prediction: Massive App Ports Fall Short Due to AI
Bernhardt predicted 2025 as peak Asm.js adoption with 'thick, extremely large applications' ported to it, frustrated developers fleeing JS pains (e.g., Brendan Eich's 10-day creation lore). Reality diverged: No massive war (as charted), but COVID and AI code generation eased JS frustrations, reducing migration urgency. Asm.js evolved into WebAssembly (Wasm), now at version 3.0 with garbage collection, better exceptions, JS string builtins, custom text annotations, and deterministic profiling – making it viable beyond early clunkiness.
Wasm Gains Traction in Production Despite JS Persistence
Wasm enables Rust, C++, Go (and experimentally Python) in Cloudflare Workers for serverless backends, bypassing JS. Notable apps like Figma use it. Hosting providers embrace it, hinting at Bernhardt's wild 'metal' vision: Embed JS VM in kernel for ring-0/3 isolation, compiling all software to Asm/Wasm. While kernel-level remains far-fetched, Wasm's inroads validate the 'JS kills JS' thesis partially – blame AI for stalling full replacement by automating JS workarounds.