WebAssembly Unleashed

Exploring JavaScript Ahead-of-time Compilation with Porffor | WebAssembly Unleashed

Jul 16, 2025
Oliver Medhurst, a former Mozilla engineer, discusses his innovative project, Porffor, which compiles JavaScript ahead-of-time to WebAssembly and native binaries. He highlights the complexities of static compilation in JavaScript and the benefits of AOT, such as smaller binaries and faster startup times. Oliver shares insights on type inference, performance improvements over interpreters, and the importance of community feedback in refining Porffor. He also delves into garbage collection strategies and offers advice to aspiring AOT compiler builders.
Ask episode
AI Snips
Chapters
Transcript
Episode notes
INSIGHT

JavaScript's Dynamism Challenges AOT

  • JavaScript's extreme dynamism makes static ahead-of-time compilation challenging because the same operation can mean different things at runtime.
  • Oliver Medhurst explains that static analysis must be very conservative to avoid incorrect assumptions.
ADVICE

Pick AOT For Environments Where JIT Fails

  • Target AOT when JIT is disallowed or startup cost matters, like embedded devices or CLI apps.
  • Use AOT to produce small binaries and reduce cold starts for serverless functions.
INSIGHT

AOT Trades Peak Speed For Consistency

  • JITs observe runtime types and specialize hot code, producing peak performance at the cost of variability.
  • Porffor aims for consistent, reliable speed gains over interpreters rather than beating JIT peak performance.
Get the Snipd Podcast app to discover more snips from this episode
Get the app