news.volyx.in

Porffor: A from-scratch experimental ahead-of-time JS engine (porffor.dev)

477 points by bpierre · 741 days ago · 138 comments on HN

Article summary

Porffor is a research project that compiles JavaScript ahead-of-time to WebAssembly and native binaries, aiming to improve performance and security. It achieves this by compiling JavaScript without packaging a runtime, resulting in smaller binary sizes and faster execution. Porffor is written from scratch with ahead-of-time compilation in mind, allowing for previously impossible optimizations. The project is still in its early stages, with some JavaScript features not yet supported.

Main themes

  • JavaScript compilation
  • Ahead-of-time compilation
  • WebAssembly
  • Native binaries
  • Performance optimization
  • Security

What commenters say

  • The use of TypeScript can help with static compilation, but its type system is not designed for this purpose and may not provide sufficient guarantees for optimization.
  • Some argue that TypeScript's type system is unsound and can lead to miscompilation and runtime errors, making it less suitable for ahead-of-time compilation.
  • Others propose that a subset of TypeScript, with stricter typing, could be used to achieve better performance and compilation results.
  • The discussion highlights the trade-offs between static and dynamic compilation, with some arguing that just-in-time compilation can provide better performance and flexibility.
  • The potential applications of Porffor, such as compiling NodeJS to native libraries, are seen as promising, but also pose significant technical challenges.
  • Some commenters note that the use of ahead-of-time compilation may introduce delays and limitations, such as the need for recompilation and potential compatibility issues.
  • The relationship between Porffor and other projects, such as Ladybird, is discussed, with some seeing potential for shared logic and others questioning the relevance of Porffor's compilation approach.