Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Shopify Engineering 4 min read Deep dive mediumAdept

After the Refactor: A Path to Faster Rendering with Liquid-C

Liquid-C's bytecode VM was refactored to replace its sequential constant pointer with per-instruction indexes into the constants array, so the instruction pointer can jump freely without recomputing constant offsets. This is a prerequisite for compiling Liquid's If and For tags via new GOTO/JMP-style instructions. A hash table now deduplicates constants (e.g. a cart template dropped from 157 to 104 constants), but the change slightly increased memory use and parse time and did not noticeably speed up theme rendering on its own.

Assumes: bytecode virtual machinestemplate enginesC Ruby extensions

Related posts

  • Copy Hunting

    TigerBeetle mediumAdept

    Reading Zig's emitted LLVM IR as plain text and grepping it is a practical substitute for staring at disassembly when chasing implicit memcopies and binary bloat. A small line-by-line tool, copyhound, flags large `llvm.memcpy` calls per function and also sums IR lines per generic function name to expose monomorphization blowup, the same idea as cargo-llvm-lines. In TigerBeetle it traced copies to `std.meta.eql`, which was replaced with a comptime-checked word-wise byte comparison. In the Zig compiler it found an inlined float-parsing slow path costing 10 KB of stack, fixed with `@setCold`. Making comptime parameters runtime in a version-printing function cut 300 bytes from the binary.

  • Speculative Optimizations for WebAssembly using Deopts and Inlining

    V8 hardMaster

    V8 in Chrome M137 adds speculative call_indirect inlining and deoptimization support for WebAssembly, using runtime call-target feedback gathered by the Liftoff baseline compiler so TurboFan can inline up to four likely callees behind cheap instance and target checks. When an assumption fails, the Deoptimizer serializes the optimized frame into a FrameDescription, rebuilds the matching Liftoff stack frame and resumes in baseline code mid-function. This lets the optimizer drop generic slow paths that would otherwise block further optimization. The gains matter most for WasmGC languages like Dart, Java and Kotlin: over 50% average speedup on Dart microbenchmarks and 1–8% on realistic applications, with one microbenchmark dropping from 675 ms to 90 ms.

  • Optimizing JavaScript Standard Library Functions in JSC

    WebKit hardMaster

    JavaScriptCore speeds up Function.prototype.toString by stacking several general optimizations that together reduce a call like f.toString() to a constant string. The result is cached on the function object, watchpoints let the DFG/FTL speculate that f and f.toString never change, an intrinsic replaces the generic call with a FunctionToString instruction that loads the cached value inline with a C++ fallback, and the abstract interpreter constant-folds the load when the receiver is known. The walkthrough also contrasts C++ and JS-implemented builtins, noting that native builtins can't be inlined but intrinsics can still emit their fast paths.

  • Introducing the JetStream 3 Benchmark Suite

    WebKit hardMaster

    JetStream 3 replaces JetStream 2's separate Wasm Startup/Runtime scores with the JavaScript-style first-iteration, worst-case and average-case scoring. The old scheme broke once engines hit sub-millisecond startup that Date.now() rounded to zero, giving infinite scores. The suite also favors larger workloads over microbenchmarks. WebKit details the JavaScriptCore work behind its results. Inlining WasmGC object fields into one allocation gave about 40% on the WasmGC subtests, and removing per-object destructors gave about 40% on Dart-flute-wasm. Other work inlines bump-pointer allocation into the BBQ and OMG tiers, uses Cohen's display for constant-time subtype checks, makes priority-based non-local inlining decisions, and profiles indirect calls for guarded inlining.

  • We Have to Start Over: From Atom to Zed

    Zed easyNovice

    Zed's co-founders explain why they abandoned Atom's Electron/JavaScript stack and rebuilt a code editor in Rust: JavaScript's pointer-chasing arrays, uncontrollable GC pauses, and the costly JS/C++ boundary for multithreading made performance work feel like fighting the platform. Rust's ownership model pushed them toward a copy-on-write B-tree (SumTree) rope built on Arc, letting snapshots move to background threads in O(1), and high-level Rust code cut a find-all-matches operation from 1s to 4ms. GPU rendering with custom shaders and signed distance fields came out of necessity after Pathfinder proved too slow. Owning the stack (Tree-sitter, GPUI) lets them change anything, such as adding WASM language extensions, at the cost of building more themselves.

The quest for software engineering knowledge.

Look:
Layout: