<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: shenjinti</title>
    <description>The latest articles on DEV Community by shenjinti (@shenjinti).</description>
    <link>https://dev.to/shenjinti</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1400450%2Fd62c62f9-5d50-4fb0-aafd-b9cca83a9549.png</url>
      <title>DEV Community: shenjinti</title>
      <link>https://dev.to/shenjinti</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shenjinti"/>
    <language>en</language>
    <item>
      <title>I Built a Register-VM JavaScript Engine in Rust with opencode.ai — Beating QuickJS</title>
      <dc:creator>shenjinti</dc:creator>
      <pubDate>Wed, 20 May 2026 14:23:47 +0000</pubDate>
      <link>https://dev.to/shenjinti/i-built-a-register-vm-javascript-engine-in-rust-with-opencodeai-beating-quickjs-3b0e</link>
      <guid>https://dev.to/shenjinti/i-built-a-register-vm-javascript-engine-in-rust-with-opencodeai-beating-quickjs-3b0e</guid>
      <description>&lt;p&gt;Three weeks ago I signed up for opencode.ai's $5 plan. I had this crazy idea: build an ES2023-compliant JavaScript engine in Rust. The result? &lt;a href="https://github.com/restsend/pipa" rel="noopener noreferrer"&gt;pipa (枇杷)&lt;/a&gt; — a register-based VM that scores &lt;strong&gt;1256 on the V8 benchmark&lt;/strong&gt;, edging out QuickJS (1219).&lt;/p&gt;

&lt;h2&gt;
  
  
  The Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;AI&lt;/strong&gt;: opencode.ai ($5/mo first month) × DeepSeek-v4-Flash&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Language&lt;/strong&gt;: Rust (edition 2024)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Binary size&lt;/strong&gt;: ~5.2 MB (including REPL, HTTP client, WebSocket)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero external deps&lt;/strong&gt; for: Regex, JSON, Base64, BigInt, Fetch, WebSocket, SSE&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Built Over 3 Weeks
&lt;/h2&gt;

&lt;p&gt;Looking back at the opencode session logs, the earliest work on pipa started on &lt;strong&gt;April 28&lt;/strong&gt;. Over the next 22 days, I worked through ~85 sessions. opencode tracked every diff — from the initial skeleton (lexer, parser, NaN-boxed value system, register VM, opcodes) through incremental refinements.&lt;/p&gt;

&lt;p&gt;The first commit created the entire foundation: ~75,000 lines across 205 source files. Then came iterative improvements — peephole optimizer passes, inline cache tuning, GC pinning logic, WebSocket handshake fixes, benchmark harnesses, and optimization levels O0 through O3.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a Register VM?
&lt;/h2&gt;

&lt;p&gt;Stack VMs need constant shuffle/dup. Register VMs name operands explicitly — fewer instructions, more optimization surface.&lt;/p&gt;

&lt;p&gt;pipa's instructions are u8 opcode + u16 register operands, variable-length (1/3/5/7/9/11 bytes). Fused &lt;code&gt;EqJumpIf&lt;/code&gt; combines compare + branch. &lt;code&gt;LoadInt8 r, imm8&lt;/code&gt; loads small integers in 3 bytes. Compact &lt;code&gt;Jump8&lt;/code&gt; uses 2 bytes for near jumps. The peephole optimizer runs 3 passes, eliminating &lt;code&gt;Move rX, rX&lt;/code&gt; and folding zero/one patterns.&lt;/p&gt;

&lt;h2&gt;
  
  
  NaN-Boxing: Everything in 64 Bits
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight nasm"&gt;&lt;code&gt;&lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="nf"&gt;x7FF8_?TTT_?PPP_PPPP_PPPP_PPPP&lt;/span&gt;
         &lt;span class="o"&gt;^^^^&lt;/span&gt; &lt;span class="nf"&gt;tag&lt;/span&gt;  &lt;span class="o"&gt;^^^^^^^^^^^^^&lt;/span&gt; &lt;span class="nv"&gt;payload&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every JS value fits in one &lt;code&gt;u64&lt;/code&gt;. A canonical NaN prefix + 4-bit tag + 47-bit payload encodes all 10 types. Type dispatch is a single shift+mask. Small integers avoid boxing entirely. Hot-path &lt;code&gt;both_int()&lt;/code&gt; checks both operands with one bitmask — straight to i64 ops.&lt;/p&gt;

&lt;h2&gt;
  
  
  Zero-Dependency Builtins
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Regex&lt;/strong&gt; (&lt;code&gt;src/regexp/&lt;/code&gt;): Layered execution — LiteralFast → FastClass → DFA → OptimizedNFA → FullNFA. The analyzer picks the fastest engine per pattern. No &lt;code&gt;regex&lt;/code&gt; crate.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JSON&lt;/strong&gt;: Hand-written recursive descent parser and serializer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fetch/WebSocket/SSE&lt;/strong&gt; (&lt;code&gt;src/http/&lt;/code&gt;): Rustls-based TLS, chunked transfer encoding, compression, WebSocket frame parsing — all from scratch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;BigInt, Base64, Unicode&lt;/strong&gt;: Hand-rolled.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Generational GC
&lt;/h2&gt;

&lt;p&gt;16 MB nursery, bump allocation, minor GC clears dead objects. If 10 consecutive minors find no garbage, it promotes to full GC with incremental marking and write barriers. Triggered every 16K allocations.&lt;/p&gt;

&lt;h2&gt;
  
  
  Performance Optimizations: What Actually Worked
&lt;/h2&gt;

&lt;p&gt;Beyond the baseline compiler, pipa has a stack of optimizations that together make it faster than QuickJS:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Peephole Optimizer (3 Passes)
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;src/compiler/peephole.rs&lt;/code&gt; runs up to 3 passes over bytecode. Each pass locally transforms patterns:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Self-move&lt;/strong&gt;: &lt;code&gt;Move rX, rX&lt;/code&gt; → NOP&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero/one folding&lt;/strong&gt;: &lt;code&gt;LoadInt rX, 0; Add rX, rY, rX&lt;/code&gt; → &lt;code&gt;Move rX, rY&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Divide-by-one&lt;/strong&gt;: &lt;code&gt;LoadInt rX, 1; Div rX, rY, rX&lt;/code&gt; → &lt;code&gt;Move rX, rY&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Jump threading&lt;/strong&gt;: &lt;code&gt;Jump → Jump&lt;/code&gt; chains resolved to the final target&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Double negation&lt;/strong&gt;: &lt;code&gt;Not; Not&lt;/code&gt; → &lt;code&gt;Move&lt;/code&gt;, same for &lt;code&gt;Neg; Neg&lt;/code&gt;, &lt;code&gt;BitNot; BitNot&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Constant folding&lt;/strong&gt;: &lt;code&gt;LoadInt 3; LoadInt 4; Add&lt;/code&gt; → single &lt;code&gt;LoadInt 7&lt;/code&gt; (supports add/sub/mul/and/or/xor)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Branch on constant&lt;/strong&gt;: &lt;code&gt;LoadTrue; JumpIf rX&lt;/code&gt; → &lt;code&gt;Jump&lt;/code&gt; (always taken), &lt;code&gt;LoadFalse; JumpIf rX&lt;/code&gt; → NOP&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LoadInt → LoadInt8 shrink&lt;/strong&gt;: Integers in &lt;code&gt;[-128, 127]&lt;/code&gt; that feed a &lt;code&gt;Move&lt;/code&gt; get shortened to 3-byte &lt;code&gt;LoadInt8&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Fused Compare-Jump Instructions
&lt;/h3&gt;

&lt;p&gt;Instead of computing a boolean to a register then branching, &lt;code&gt;EqJumpIf&lt;/code&gt;, &lt;code&gt;LtJumpIfNot&lt;/code&gt;, &lt;code&gt;StrictEqJumpIf&lt;/code&gt; etc. (16 fused pairs) directly compare two values and conditionally jump in a single opcode. This eliminates intermediate register pressure and reduces instruction count on every comparison.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. NaN-Boxing Fast Paths
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;both_int()&lt;/code&gt; in &lt;code&gt;src/value.rs:194&lt;/code&gt; uses a single bitmask operation to check whether &lt;em&gt;both&lt;/em&gt; operands are tagged integers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;TAG_MASK&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;u64&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;QNAN_BASE&lt;/span&gt; &lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0xF&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;TAG_SHIFT&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="na"&gt;.0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;TAG_MASK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;INT_TAG_BITS&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="na"&gt;.0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;TAG_MASK&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;INT_TAG_BITS&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is used &lt;strong&gt;29 times&lt;/strong&gt; in &lt;code&gt;vm.rs&lt;/code&gt; across all arithmetic and comparison opcodes. When both operands are integers, the VM directly performs i64 arithmetic — no type dispatch, no &lt;code&gt;ToNumber&lt;/code&gt; coercion. Similarly, &lt;code&gt;both_raw_float()&lt;/code&gt; skips tagging for raw f64 pairs.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;is_fast_int()&lt;/code&gt; in &lt;code&gt;new_float()&lt;/code&gt; automatically converts f64 values that fit in 47 signed bits back to tagged ints, maximizing the chance future operations hit the fast path.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Shape + Inline Cache
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;src/object/shape.rs&lt;/code&gt; implements a V8-style hidden class tree. Each object points to a Shape that records property-name-to-offset mappings via transition chains (add property → new child shape).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;src/compiler/ic.rs&lt;/code&gt; implements two-way polymorphic inline caches (&lt;code&gt;IC_POLY=2&lt;/code&gt;). Each cache slot stores &lt;code&gt;(shape_id, property_offset)&lt;/code&gt;. On property access, the VM compares the object's shape ID against cached slots — on hit, it reads directly from the cached offset, bypassing hash lookup entirely. For monomorphic hotspots (one shape), this is a single shape compare + pointer offset load.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Cached Raw Pointers in VM
&lt;/h3&gt;

&lt;p&gt;The VM struct caches 7 raw pointers updated on each call frame push:&lt;br&gt;
&lt;code&gt;cached_code_ptr&lt;/code&gt;, &lt;code&gt;cached_const_ptr&lt;/code&gt;, &lt;code&gt;cached_registers_base&lt;/code&gt;, &lt;code&gt;cached_registers_ptr&lt;/code&gt;, &lt;code&gt;cached_ic_table_ptr&lt;/code&gt;, &lt;code&gt;cached_upvalue_slot_ptr&lt;/code&gt;, &lt;code&gt;cached_upvalues_len&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Hot-path instruction handlers access bytecode, constants, and registers through these cached pointers rather than chasing through &lt;code&gt;frames[frame_index]&lt;/code&gt; on every instruction. This eliminates pointer indirection in the inner loop (~9000 lines of &lt;code&gt;execute_inner&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Opcode-Level Shortcuts
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;LoadInt8 r, imm8&lt;/strong&gt;: Loads &lt;code&gt;[-128, 127]&lt;/code&gt; in 3 bytes instead of 7 for full LoadInt&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AddImm8 / SubImm8 / LteImm8&lt;/strong&gt;: Arithmetic with small integer constants encoded directly in the instruction&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Call0 / Call1 / Call2 / Call3&lt;/strong&gt;: Specialized call opcodes that skip argument counting&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Jump8 / JumpIf8&lt;/strong&gt;: 2-byte jumps for near targets (saves 3 bytes per jump)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Micro function inlining&lt;/strong&gt; (O2+): &lt;code&gt;x =&amp;gt; x.prop&lt;/code&gt; or &lt;code&gt;x =&amp;gt; x.a.b&lt;/code&gt; detected in codegen and inlined as &lt;code&gt;GetNamedProp&lt;/code&gt; sequences, eliminating frame allocation&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  7. Generational GC with Incremental Marking
&lt;/h3&gt;

&lt;p&gt;The GC (&lt;code&gt;src/runtime/gc.rs&lt;/code&gt;, ~1550 lines) uses a 16 MB nursery with bump allocation. Minor GC is nearly free — scan roots, sweep white. If 10 consecutive minor GCs find nothing to collect, it promotes to full GC. Full GC uses incremental marking with configurable budget per step, avoiding long stop-the-world pauses. Write barriers protect black→white references during incremental marking.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. Layered Regex Engine
&lt;/h3&gt;

&lt;p&gt;The regex engine (&lt;code&gt;src/regexp/&lt;/code&gt;) is the biggest single win — 3× faster than QuickJS on the V8 RegExp benchmark. It uses a five-tier execution strategy:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mode&lt;/th&gt;
&lt;th&gt;When&lt;/th&gt;
&lt;th&gt;How&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;LiteralFast&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Pure literal string (no metacharacters)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;memcmp&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;FastClass&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Simple character class only&lt;/td&gt;
&lt;td&gt;Byte-by-byte &lt;code&gt;FastClassMatcher&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;LiteralDFA/ClassDFA&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Simple patterns compilable to DFA&lt;/td&gt;
&lt;td&gt;Linear-time DFA execution&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;OptimizedNFA&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Medium complexity with optimizations&lt;/td&gt;
&lt;td&gt;Optimized NFA bytecode&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;FullNFA&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Complex patterns with backreferences&lt;/td&gt;
&lt;td&gt;Full backtracking NFA with pooled contexts&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The pattern analyzer (&lt;code&gt;analyze_pattern&lt;/code&gt;) classifies each regex at compile time and selects the cheapest engine that can handle it. Most real-world regexes hit the DFA or faster tiers.&lt;/p&gt;

&lt;h2&gt;
  
  
  test262 Coverage: What We Tried
&lt;/h2&gt;

&lt;p&gt;Running the official ECMAScript test suite (test262) has been an ongoing effort. Here's what's in place:&lt;/p&gt;

&lt;h3&gt;
  
  
  test262 Runner
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;examples/test262_runner.rs&lt;/code&gt; (~500 lines) is a standalone test harness that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Parses YAML frontmatter from test files (&lt;code&gt;/*--- ... ---*/&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Handles test &lt;strong&gt;flags&lt;/strong&gt; (onlyStrict, noStrict, raw, async, generated)&lt;/li&gt;
&lt;li&gt;Resolves test &lt;strong&gt;includes&lt;/strong&gt; (harness helper files like &lt;code&gt;assert.js&lt;/code&gt;, &lt;code&gt;sta.js&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Detects &lt;strong&gt;negative&lt;/strong&gt; tests (expected failures with specific error types)&lt;/li&gt;
&lt;li&gt;Tracks per-file pass/fail statistics with console output&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;test262.sh&lt;/code&gt; scripts the full flow: clone test262 from tc39, then invoke the runner.&lt;/p&gt;

&lt;h3&gt;
  
  
  Current Coverage: ~45%
&lt;/h3&gt;

&lt;p&gt;The engine passes roughly 45% of the test262 suite. Major working areas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Lexical grammar&lt;/strong&gt;: Identifiers, keywords, Unicode escape sequences, line terminators&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Expressions&lt;/strong&gt;: Primary, left-hand-side, unary, binary, conditional, assignment&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Statements&lt;/strong&gt;: Block, variable/function declarations, if/switch/while/for/for-in/for-of, try/catch/finally, return/throw/break/continue&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Built-in objects&lt;/strong&gt;: Object, Array, String, Number, Boolean, Symbol, BigInt, Math, Date, RegExp, JSON, Map, Set, Promise, Proxy, Reflect, TypedArrays, Intl&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Control flow&lt;/strong&gt;: Aberrant behavior detection, early error handling&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modules&lt;/strong&gt;: import/export, namespace objects&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What's Missing
&lt;/h3&gt;

&lt;p&gt;The remaining 55% mostly falls into:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Annex B&lt;/strong&gt; (browser extensions): &lt;code&gt;__proto__&lt;/code&gt;, &lt;code&gt;Object.prototype.__defineGetter__&lt;/code&gt;, &lt;code&gt;RegExp.$1&lt;/code&gt; etc.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Edge cases&lt;/strong&gt; in temporal dead zone and class field initialization&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Async generator&lt;/strong&gt; finalization corner cases&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Atomics/SharedArrayBuffer&lt;/strong&gt;: The single-threaded model doesn't support these yet&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Intl.NumberFormat v3&lt;/strong&gt;: Recent additions to the Intl spec&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The MIR layer (&lt;code&gt;src/compiler/mir.rs&lt;/code&gt;, ~460 lines) is designed but not yet connected to the main pipeline — once wired, it will enable better dead code elimination, type inference, and potentially SSA-based optimizations.&lt;/p&gt;

&lt;h2&gt;
  
  
  How opencode Helped
&lt;/h2&gt;

&lt;p&gt;I'd never have built this without AI pair programming. The workflow — describe what I want, get working code, test, refine — collapsed months of work into 3 weeks.&lt;/p&gt;

&lt;p&gt;The session timeline tells the story:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Period&lt;/th&gt;
&lt;th&gt;Focus&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Week 1 (Apr 28–May 4)&lt;/td&gt;
&lt;td&gt;Core engine: lexer, parser, register VM, NaN-boxing, opcode encoding, basic builtins&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 2 (May 5–11)&lt;/td&gt;
&lt;td&gt;Optimizations: peephole passes, shape system, inline caches, regex engine, bytecode serialization&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Week 3 (May 13–20)&lt;/td&gt;
&lt;td&gt;HTTP stack: fetch, WebSocket, SSE, EventSource; process API; benchmarks; REPL polish&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;DeepSeek-v4-Flash understood Rust borrow semantics, generated correct unsafe NaN-boxing code, wired up TLS handshakes, and debugged GC edge cases. Without it, this project would have stayed a weekend thought experiment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;cargo &lt;span class="nb"&gt;install &lt;/span&gt;pipa-js
pipa script.js
pipa &lt;span class="nt"&gt;-compile&lt;/span&gt; input.js output.jsc   &lt;span class="c"&gt;# pre-compile to bytecode&lt;/span&gt;
pipa &lt;span class="nt"&gt;-O3&lt;/span&gt; script.js                   &lt;span class="c"&gt;# max optimization&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;MIT licensed on &lt;a href="https://github.com/restsend/pipa" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. PRs and stars welcome.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>javascript</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
