Back

Oliver Medhurst

1 year of Porffor

My JS engine is a year old today! Let's recap what has happened lately and what the future holds.

Porffor is a year old as of today! 🎂 Porffor is my hobby JS engine which is quite unique; it compiles JS to WebAssembly ahead-of-time! This is unlike major JS engines which either interpret or just-in-time compile JS. I’m using this different approach to research the potential of it and what it could allow as a novel JS engine/compiler (plus just for fun).

Screenshot of terminal showing Porffor running and compiling a hello world

Recap

Let’s recap each major update to Porffor since around January:

  • Porffor now has objects! Yep, they were not supported before due to their polymorphic nature being complex to handle internally, but since ~last week it now has them!
  • Indirect calls. Previously, Porffor did not support “indirect calls” - calls which the compiler did not know what was being called at compile-time. It is now supported, allowing callback arguments and more!

Test262

Test262 is the official ECMAScript conformance test suite most engines use for spec compliance testing. On January 31st, Porffor was passing 11.13% of all of Test262. Today, it is passing 21.89%! That is almost doubling in just these last few months, and the rate is increasingly exponentially!

Graph of Porffor Test262 over time

Native compilation

Since we are compiling JS to Wasm AOT, why can’t we compile to native binaries too? We can! I wrote my own custom Wasm to C compiler specialized for Porffor, so it can now compile JS to native binaries which just run on your system. Not only are the binaries tiny (<20KB) but they are fast (>2x fast as Node in some tests) too, also consuming much less memory (1-2MB).

Screenshot of a terminal showing Porffor compiling and using a cat program Screenshot of a terminal showing Porffor compiling and using a Brainf interpreter program

Future

The main current goal is just to make more JS work with it so more scripts can run, also improving our spec compliance. Also ensuring we can continue to compile to tiny+fast native binaries along the way. Maybe one day we can compile some JS CLIs to native? We’ll see!

Stay tuned on development via Twitter and/or Mastodon. Interested in contributing? Message! Thanks for reading!