pipa (枇杷) - A fast, minimal ES2023 JavaScript runtime built in Rust.
Features
- ES2023 compliant — implements the ECMAScript 2023 specification
- Async/await built-in — first-class async/await support without transpilation
- Bytecode support — compile JavaScript to
.jscbytecode files for fast loading and execution, with configurable optimization levels (-O0through-O3) - Fast — outperforms QuickJS in benchmarks
- Small — ~5.2 MB binary (with
replfeature) - Zero-dependency built-in implementations for:
- Regex/JSON/Base64/BigInt
- Unicode
fetch(HTTP client),rusttlsrequired- WebSocket
- Server-Sent Events (SSE)
No external C libraries or system dependencies for the above — everything is implemented from scratch in Rust.
Benchmarks (2026-05-23)
V8 benchmark suite comparison (higher is better):
| Benchmark | qjs | node | boa | pipa | vs qjs |
|---|---|---|---|---|---|
| Richards | 978 | 46846 | 133 | 1005 | +2.8% |
| DeltaBlue | 946 | 94979 | 140 | 1034 | +9.3% |
| Crypto | 1067 | 60072 | 125 | 1120 | +5.0% |
| RayTrace | 1507 | 79697 | 315 | 1052 | -30.2% |
| EarleyBoyer | 2153 | 95129 | 281 | 1441 | -33.1% |
| RegExp | 334 | 12703 | 41.6 | 1046 | +213.2% |
| Splay | 2432 | 48609 | 536 | 1999 | -17.8% |
| NavierStokes | 1882 | 56392 | 288 | 1941 | +3.1% |
| SCORE (total) | 1220 | 53836 | 184 | 1279 | +4.8% |
Ranking: #1 node (53836) · #2 pipa (1279) · #3 qjs (1220) · #4 boa (184)
test262 Compatibility (2026-05-23)
Tested against tc39/test262 (excluding intl402 and annexB).
| Category | Pass Rate | Notes |
|---|---|---|
| Core Operators | ||
| Addition, Coalesce, Comma, Grouping, Logical-And/Or, Strict-Equals/Not-Equals, Void, Bitwise-Not, Relational | 100% | Fully compliant |
| Subtraction, Division, Multiplication, Modulus, Exponentiation | 64–82% | Mostly compliant |
| Control Flow | ||
if |
94% | |
for |
81% | |
while |
74% | |
switch |
78% | |
try/catch/finally |
74% | |
const/let |
73–74% | |
| Functions | ||
| Function declarations/expressions | 66–73% | |
| Arrow functions | 80% | |
| Generators | 65–67% | |
| Builtins | ||
| Math | 49% | |
| JSON | 23% | |
| Boolean | 59% | |
| Promise | 7% | Limited async support |
| Proxy/Reflect | 0–19% | Not yet implemented |
| Set/Map/WeakMap/WeakSet | 6–23% | Partial implementation |
Overall sampled pass rate: ~52% (5327 tests sampled across all categories above)
Usage
# Run a script
# Run precompiled bytecode
# Compile JavaScript to bytecode
# Disassemble bytecode (debugging)
# Specify optimization level (default: -O2)
# Start REPL (requires the repl feature)
Embedding in Rust
Use pipa-js as a library to embed JavaScript in your Rust project:
[]
= "0.1.2"
Evaluate JavaScript
use ;
let mut rt = new;
let mut ctx = rt.new_context;
let val = eval.unwrap;
assert_eq!;
Read strings & values from JavaScript
use ;
let mut rt = new;
let mut ctx = rt.new_context;
eval.unwrap;
let val = eval.unwrap;
assert!;
let s = ctx.get_atom_str;
assert_eq!;
Call custom Rust functions from JavaScript
use ;
let mut rt = new;
let mut ctx = rt.new_context;
ctx.register_global_builtin;
eval.unwrap;
Async/await with event loop
use ;
let mut rt = new;
let mut ctx = rt.new_context;
eval_async.unwrap;
let val = eval.unwrap;
println!;
Requires the
fetchfeature (enabled by default).eval_asynciseval+run_event_loopin one call.
Bytecode compilation
use ;
let mut rt = new;
let mut ctx = rt.new_context;
// Compile JavaScript to register-based bytecode
let = compile_to_register_bytecode.unwrap;
// code: Vec<u8>, constants: Vec<JSValue>
assert!;
Build
# Default build (includes REPL, fetch, and process support)
# Minimal build (no REPL, no fetch, no process)
If using pipa as a library dependency and you don't need REPL/fetch/process features, add it with
default-features = false:[] = { = "0.1.1", = false }
License
MIT