Core Options
Debug Mode
Enable debug mode. Includes function names in generated Wasm and enables debug logging.
Module Parsing
Parse input as an ES module instead of a script.
Secure Mode
Enable secure mode. Errors on unsafe Porffor features like FFI.
Memory & Allocation
Allocator
Select the memory allocator algorithm.Options:The chunk allocator grows memory in configurable chunks (see
chunk(default) - Chunk-based allocator with dynamic growthoneshot- One-shot allocator, faster for short-lived programs (used in Lambda)
--allocator-chunks).Number of Wasm pages (64KB each) to allocate per chunk when using the chunk allocator.Source reference:
source/compiler/builtins.js:1046Page Size
Internal page size for memory allocation. Default is 16384 (65536 / 4).Source reference:
source/compiler/index.js:80Exception Handling
Exception handling mode to use.Options:The
stack(default) - Stack-based exception handlinglut- Look-up table based exception handling
lut mode is used by precompile for built-in functions. The stack mode passes exception values on the stack.Source reference: source/compiler/codegen.js:5499Enable or disable Wasm exception handling proposal.
Random Number Generation
Select the pseudo-random number generator algorithm for Different algorithms offer different trade-offs between speed and randomness quality. The default
Math.random().Options:xorshift32+xorshift64+xorshift128+(default)xoroshiro128+xoshiro128+
xorshift128+ provides a good balance.Source reference: source/compiler/builtins.js:617-852Valtype
Primary value type for Wasm operations.Options:Source reference:
f64(default) - 64-bit floating pointi32- 32-bit integer (not well supported)
source/runtime/index.js:64Output & Analysis
Disassembly
Print disassembled Wasm generated from user functions.Source reference:
source/compiler/index.js:18Display function disassembly after optimization.
Benchmarking
Print timing information for compilation and execution.
Print Wasm binary size.
Log general compiler performance. Enabled by default when compiling to a file.
Builtin Analysis
Display tree of builtin function dependencies.
Log memory allocation details during compilation.Source reference:
source/compiler/index.js:208Wasm Import/Export
Treeshake (remove) unused Wasm imports.
Use passive Wasm data segments.Automatically disabled when compiling to C/native.
Advanced Options
Tail Call Optimization
Enable tail call optimization using Wasm tail call proposal.Source reference:
source/compiler/opt.js:10Wasm Optimizer
Run wasm-opt on generated Wasm binary.Requires
wasm-opt to be installed and available in PATH.Source reference: source/compiler/index.js:215COCTC
Enable Cross-Object Compile-Time Cache.
Closures
Enable closure support.
See Also
- Optimization Levels - Optimization level flags
- Parser Options - Parser selection and configuration
- TypeScript Support - TypeScript-specific options