Porffor is a research project exploring new approaches to JavaScript compilation. While it has significant limitations, what it can do, it does exceptionally well.
What Makes Porffor Different
Porffor takes a unique approach to JavaScript execution that sets it apart from traditional engines:100% AOT Compiled
No JIT compilation or interpreter. Your code is compiled ahead-of-time directly to WebAssembly or native binaries.
Zero Runtime
No constant runtime or preluded code. The compiled output contains only what your code needs.
Minimal Imports
Only essential I/O operations are imported. Everything else is compiled into your binary.
From Scratch
Built entirely from the ground up (except the parser). Porffor generates final Wasm binaries itself without relying on tools like Binaryen.
Key Features
Multiple Compilation Targets
Compile your JavaScript to different formats depending on your needs:- WebAssembly - Generate standalone
.wasmfiles - C - Compile to C code using Porffor’s 2c compiler
- Native Binaries - Create executable binaries for your platform
- REPL - Interactive JavaScript execution
TypeScript Support
Porffor can parse and compile TypeScript code with type annotations:--opt-types to enable optimizations based on type hints, making your compiled code even faster.
Performance
For the features it supports, Porffor delivers exceptional performance:Porffor is typically blazingly fast compared to interpreters and engines running without JIT. With compiler optimizations and typed input, it can even compete with JIT-enabled engines, especially when compiled to native binaries.
Architecture
Porffor is primarily built from scratch with minimal dependencies:- Parser: Uses Acorn (with support for Babel, Meriyah, and Hermes parsers)
- Compiler: Custom-built code generator that produces WebAssembly bytecode
- Assembler: Creates spec-compliant Wasm modules from scratch
- 2c: Porffor’s own WebAssembly-to-C compiler for native binary generation
Current Limitations
As an experimental research project, Porffor has some important limitations:Versioning System
Porffor uses a unique versioning scheme. For example, version0.61.10:
- 0 - Major version (always 0 until Porffor is production-ready)
- 61 - Minor version (Test262 pass percentage, rounded half-down)
- 10 - Micro version (build number for that minor version)
0.61.10 passes 61% of Test262 tests and is the 10th build at that pass rate.
Use Cases
While Porffor is still experimental, it offers some compelling benefits:Safety
Written in JavaScript (memory-safe) and compiles to WebAssembly (fully sandboxed), providing multiple layers of security.
Native Binaries
Compile JavaScript directly to standalone executables for your platform.
Inline Wasm
Write inline WebAssembly for performance-critical sections or low-level operations.
SIMD Operations
Potential for SIMD and other low-level optimizations not available in traditional JavaScript.
WebAssembly Proposals
Porffor uses only widely-implemented WebAssembly proposals to ensure maximum compatibility:- Multi-value (required)
- Non-trapping float-to-int conversions (required)
- Bulk memory operations (optional)
- Exception handling (optional, only for errors)
- Tail calls (opt-in, disabled by default)
Next Steps
Installation
Install Porffor and set up your environment
Quick Start
Get started with your first Porffor program