Porffor

GitHub Discord

A from-scratch experimental ahead-of-time JS engine

Porffor is a unique JS engine/compiler/runtime, compiling JS code to WebAssembly or native ahead-of-time.
It is seriously limited for now; intended for research and fun, not serious use!

Wasm compilation

Porffor's WebAssembly output is much faster and smaller compared to existing JS -> Wasm projects. This is because Porffor compiles JS AOT instead of bundling an interpreter.

  • Wasm size: 32x smaller than Javy (~1.3MB -> ~40KB)
  • Wasm perf: 18x faster than Javy (~70m -> ~4m)

Native compilation

Due to compiling JS ahead-of-time, Porffor can compile to real native binaries without just packaging a runtime like existing solutions. This leads to:

  • Binary sizes over 1000x smaller (~90MB -> <50KB)
  • Memory usage over 40x less (~50MB -> ~1MB)
  • Performance up to 3x faster

Plus...

Porffor is safe as it compiles to Wasm (and then native). It is also written in a memory safe language (JS).

Porffor is written from the ground-up with AOT in mind instead of being based on any existing JS engine. The only dependency is a JS parser.

Porffor supports TypeScript input, no clunky transpiler step needed: just feed it a TS file.

Porffor
19s
Bun
43s
Node
67s

Execution time for a benchmark (running a BF interpreter running mandelbrot.bf). Porffor ran using native compilation.

Playground You can try Porffor here online or locally with npm i -g porffor@latest && porf

Parser Target

Test262 Test262 is the official ECMAScript conformance test suite. Porffor is ran against it each commit to track conformance progress!

3 months
6 months
all-time