1 of 18

Porffor

Compiling JS ✨ Ahead-Of-Time ✨

Oliver Medhurst

2 of 18

Oliver Medhurst @canadahonk

  • Creator of Porffor (stay tuned)
  • WinterCG co-chair (standardizing JS across runtimes)
  • TC39 invited expert (improving JS)

3 of 18

Interpretation

JavaScript

source code

Executed

QuickJS

4 of 18

Just-in-time Compilation

JavaScript

source code

Machine code

V8

Executed

5 of 18

JIT Tradeoffs

  • Longer compile time = faster running time 🤠�Longer compile time = longer loading time 😔
  • Security can be 😬

6 of 18

Ahead-of-time Compilation

C++

source code

Binary

(Native, Wasm, etc)

Clang

7 of 18

Just-in-time Compilation

Unusable outside of the JS engine!

JavaScript

source code

Machine code

V8

Executed

8 of 18

AOT Fixes JIT Tradeoffs

  • Longer compile time = faster running time 🤠�Longer compile time = longer loading time 😔
  • Security can be 😬

9 of 18

Ahead-of-time Compilation

JavaScript source code

Binary

(Wasm, native, etc)

???

10 of 18

Introducing Porffor

JavaScript source code

Binary

(Wasm, native, etc)

✨ Porffor ✨

11 of 18

Test262: 47.68%

12 of 18

Test262: 47.68%

FUNDING

13 of 18

Performance

Natively compiled - BF Mandelbrot demo

14 of 18

Tiny native compilation

Hello world

15 of 18

Tiny native compilation

Hello world

15KB!

16 of 18

Supports TypeScript input

17 of 18

Written in JS + TS

18 of 18

Thanks! Questions?

Please ask anything and say hi after!

Follow progress on 🐦 @canadahonk or 🌐 porffor.dev