Hazel reports · ^report(48) · for Cyrus · 2026-11-08, updated 2026-11-10 09:41 MST · work in progress · for the meeting with Cyrus on Wednesday 2026-11-11 (^report(42))

Why Hazel Is Slow: A Thousand Cuts

Cyrus wants to know why Hazel is slow. Matthew, 2026-11-08: "Cyrus wants to know why Hazel is slow, and I say: death by a thousand cuts. I'd like more substance behind that idea." This report is that substance: the costs this series has measured in Hazel, 196 of them from 33 reports, side by side, each with its number, what it was measured on, whether it is fixed, and the design choice it comes from.

Outline#

  1. In short: no single bottleneck; 196 measured costs, many of them most of their workload, many multiplying one another, from four design choices applied everywhere.
  2. All the costs at once: a treemap, one rectangle a cost.
  3. The four families: values held as terms; whole-program work on every edit; values moved as terms across boundaries; an interpreter that pays for the editor at every step.
  4. The largest costs: fourteen that were each most, or a large part, of their workload.
  5. How the costs multiply: five cases where one cost makes another larger.
  6. One small edit, change by change: the Witch slide's slider, from 4.2 to 6.5 s down to 1.3 to 1.7 s, and the 16.7 ms still to go.
  7. Where the fixes are: most on the livelits branches and trial branches, a few in open PRs to dev, two merged.
  8. Beside Fumola: half the steps, each about 20 times the cost.
  9. Recommendations: merge the open PRs (a table, each with its measured gain), port what the branches measured, change the three choices behind most costs, and track the goal on dev; and the ledger, every cost, with its report.

Update, 2026-11-08 evening: the Witch's whole run, compiled, now runs in the app at a slider's step (^report(49)): in Firefox it answers in 10 to 12 ms (3 to 4 ms for the next event of a drag), all 53 livelits' views included, and in 2 of 4 steps the picture showed at the page's first redraw, 318 and 469 ms after the step, against 1.90 to 2.24 s with nothing compiled in the same run. On those steps the evaluator is out of the way; what is left is the page's own work (statics, the whole slide's view twice) and the program compiled again after each step.

In short#

Hazel is slow for many reasons at once, not for one. The series has measured 196 separate costs; many are most of the workload they were found in, and many make one another larger. Remove the biggest and the next is there: on the Witch slide, the trip of the worker's answer was 70 to 72% of a small edit; with it trimmed, the evaluator is now most of it. (Update, 11-08 evening: with the run compiled in the page, the evaluator is out of the way on the steps it answered, and the page's own work, 318 to 469 ms, is most of what is left: ^report(49).)

They come from four design choices, each sound on its own and each applied everywhere:

Each choice buys something Hazel is for: holes, live evaluation, probes, a stepper, an editor that is never in an invalid state. The cost is that every one of them is paid on every value and every edit, including the many that need none of it.

All the costs at once#

196 measured costs, from 33 reports: one rectangle each, grouped by what they come from, coloured by where they standThe first release after a load re-parsed the whole program (the wrong parse cache was filled): commit 245 ms instead of ~60 (001#pipeline; fixed)A module binding's definition analyzed a second time: 1.79 s of 4.2 s of statics (about 43%); CLI statics 6.7 s; on dev, about 0.13 s of 6 s on an 800-function module (024#cost (also 001#issues, 017#pr2651); fixed)A livelit definition analyzed twice (synthesis, then analysis): Shirt and Pants statics 4.3 s (001#issues; fixed)Statics re-ran 3x per edit (probe pins compared to the wrong keys): head-colour slider 20.6 s (001#issues; fixed)Statics rebuilt the spine root of every item below the edit: 149 of 179 roots re-added per release; statics 42 ms (Witch), 23 ms (Full Body) (013#change; fixed)Per-member module analysis lost on #2635 after a merge, so a module literal is analyzed whole: edits in mega-mod-1k wrapped in a module ~100 ms vs 7 ms (Andrew Blinn's commit message) (018#why; fixed)Completion suggestions computed after every typed digit (a pass over the program): 178 ms, 10% of the profile (036#fix-digits; fixed)Compiling a program for the library (parse, then statics): the game's rules 797 ms; first compile in the browser 340-520 ms; Hazel 514 ms where Fumola sets up in 4 ms (027) (025#prs (also 027#next, 030#built); mitigated)Edit, undo and redo each grow linearly with the program: at 6,400 definitions: edit 106 ms, undo 292, redo 184 (163/422/340 before two fixes), each followed by ~78 ms of statics; log-log slope 1.10-1.16 (036#scaling (also 038#time); mitigated)Every let-bound function takes statics' recursive path; passes multiply with nesting (up to 4^depth): 001: nested lets 400 s; 017: 5.3 s of statics at eight levels; b2t2 example-tables 73 ms (017#pr2603 (also 001#issues); open PR)#2597 re-runs statics on the whole program after every livelit commit: 3.5 s of a 5.8 s profiled release (CachedStatics.init); release 3.76 s on #2597 against ~0.35 s on #2635 (001#pipeline; open)The commit re-makes the syntax (livelit placeholder shapes, per-item parsing): 26 ms profiled per release (001#now; open)Statics analyzes some expressions several times per multiplier (recursive lets, shadowed builtins, unannotated labelled params): up to 12x per expression on B2T2 programs, 3^d for nested recursion (001); a recursive let 3x, nested recursive lets 27x (021) (001#issues (also 021#pr-2689); open)#2597 runs whole-program statics from scratch on every update during load: 15% of the main thread (007#why; open)#2597 runs whole-program statics on every slider change (no modular editing): 5.4 s of a 13.3 s profiled change; median 8.6 s against 1.2 s on #2635 (statics 38 ms there) (008#a; open)Opening slides: statics: 23 s of 213 s (about 11%) (020#timing; open)Opening slides on #2597 (no per-item statics): statics dominates: statics 143 s of 362 s of script (about 40%); figure slides 35-71 s (6-8 s on #2635); ConstructorMap.re 45 s (4.5 s on #2635) (020#timing; open)The first event after a reset compiles the rule program: 0.5-0.7 s (502, 692, 519 ms); Fumola's slowest pull 12-21 ms (032#table; open)After an edit, readiness grows with the program (whole-program analysis): 357.5/435.4/744 ms at 1x/2x/4x Common's size (~4 ms a line); analysis 260/302/428 ms; Fumola flat ~125 ms (032#scale; open)First load of the library and its first analysis: about a second ('analyzed and run in 1148 ms') (034#mudu; open)MakeTerm rebuilds the whole top-level term every step: 523 ms, 38% of the profile (527 ms, 29% before the fixes) (036#where (also 038#time); open)DefStatics walks the whole chain of definitions every step: 283 ms, 20% (289 ms, 16% before) (036#where (also 038#time); open)Building and rebuilding a small program: first build 338-366 ms; rebuild after an edit 138-154 ms whether a module changed or not; ~180 ms in the browser (043#cost; open)The page's work after a livelit event (the program's text changed and analysed again, the editor drawn), now most of an event: a click's change 77 ms compiled vs 124 on Polygons; 319 vs 368 ms on Full Body; 304 vs 354 on the Witch; a drag step 36 vs 62 ms, while the livelit's own update is ~0.05 ms (045#browser; open)The main thread's own work on an edit before the request goes (update, a page view, statics and the request's pieces): 0.31-0.41 s to the page's first change (19-24 frames); 0.18-0.27 s before the request in the timeline run (046#witch-edit (also 046#witch-edit-parts); open)Nested module bindings multiply statics passes (3^depth on dev, 2^depth with #2651, counted from code): depth-9 function chain 31.04 and 29.59 s with #2651; 3.8-3.9x per level; depth-12 fix chain 197.2 s (024#next; other)Analysis of a module grows superlinearly with its members: 100 short members ~110 ms, 400 members ~2.3 s (4x the members, ~21x the time) (034#release-found (also 039#package); other)Initial build of the editor for a large program: 173 ms at 400 definitions up to 2,637 ms at 6,400 (036#scaling; other)re-analysis per edit (28)The code editor re-checked every tile's sort on every commit: check 16 ms, code editor 26 ms profiled (3-5 ms on the clock); 25,852 tiles per commit on mega-4k (001#now; fixed)Measuring the page after each redraw forced synchronous layouts and document-wide style recalcs: after-display effect 24 ms profiled; main-thread work 246 ms per release (001#now; fixed)The problems panel walked the whole program for incomplete tiles on every redraw: panel 13 ms, walk 6 ms profiled (001#now; fixed)A view re-evaluated every call though only one input changed: face's first evaluation after a release 43 ms (median of 12) (001#pipeline; fixed)Every redraw evaluated every livelit's view, changed or not: Kids' Choice 0.8 s (001#issues; fixed)Cursor info rebuilt the program's source and compared it structurally on every redraw: ~40 ms profiled per release (001#issues; fixed)^picture's view box walked every point; points strings built point by point: view_box 134,320 steps (56%), coords 92,703 (39%) of 238,781 view steps (004#update; fixed)The context inspector prints every prelude type whole as tiles: 6,802 tokens drawn for a 4-line program; froze the browser on Scenes (020#gamma; fixed)The page rebuilds its whole view in JS on every redraw, and a release redrew six times: about 310 ms (profiled) of a 0.43 s release (001#pipeline; mitigated)^picture's view prints every point to SVG text in Hazel code; the worker computes points one at a time: ~1.7 s per change on the main thread and ~1.5 s in the worker (profiled) (002#hands; mitigated)The page drawing a woods picture it had not drawn before: 5.7-6.6 s (0.6-1.1 s for one drawn before) (004#timeline; mitigated)HazelDOM drawing a view's Hazel Html into virtual DOM: 0.44 ms, more than the trip back (0.27 ms); 0.71 ms through Hazel vs 0.30 ms straight from JS (045#direct; mitigated)#2597's view rebuild without #2469's caches and gates: 1.6 s profiled (~0.37 s on #2635): view samples rerun 0.57 s, uncached code view 0.41 s, incremental-eval overlay drawn though off 0.39 s, whole-program re-parse 0.2 s (001#pipeline; open)Livelit views evaluated in each redraw: 44 ms profiled per release (face evaluation 21, its Html to the page 8, probe sample views 7, rest 8) (001#now; open)The app's own update machinery (frame callbacks, recomputing its views): 25% of the page's main thread (005#update; open)#2597 rebuilds the code editor's view of the whole program on every update: 77% of the main thread during load (007#why; open)#2597 rebuilds the whole code view and prints the whole program to text on every change: code view 2.3 s, program to text 1.5 s (profiled) (008#a; open)Cells' livelit views drawn without the view memo: about 0.46 s per change profiled; updated 10-14: ~340 ms of profile, perhaps 0.1-0.2 s on the clock (008#b; open)Livelit views evaluated on the page inside the editor's update: about 450 ms of a Full Body change's ~1,010 ms of page JS (the update ~860 ms) (015#change; open)Opening slides: the page's view: 55 s of 213 s of script (about 26%) over 58 slides; 30-40% on most slides (020#timing; open)Opening slides: layout: 13 s of 213 s (about 6%) (020#timing; open)Layout's walk over the program (Measured.of_segment): 78 ms, 6% of the profile (036#where; open)With the sidebar shown, every edit rebuilds the outline: 44 ms after an edit of 51 ms at 3,200 definitions; 84 after 113 at 6,400 (038#sidebar; open)The whole slide's page view, drawn five times an edit: 24-506 ms (median 117) each draw; 0.5-0.9 s an edit; the picture's own view 3.0 ms of it (046#witch-edit-parts (also 047#goal); open)Html to virtual DOM, the vDOM diff and patch, browser layout: 1.1%, 0.9%, 1.4% of the woods main thread (005#update; other)the page's view and redraw (25)Reuse check compares cached expressions by structure, walking down to the edit once per enclosing let (quadratic along the lets): reuse_check ~283 ms of a ~410 ms worker release (profiled); on dev, 2,743 ms to re-evaluate after one edit in a 400-definition program (4,353 ms with hashing alone) (001#pipeline (also 017#pr2673); fixed)Reusing a cached result walked the whole reused code to copy cache entries: 16 ms of the worker's 47 ms evaluation (profiled) (001#now; fixed)A projector update copies the whole program, so identity-keyed caches (per-item parsing) see a new program: Kids' Choice release 1.5-1.7 s; dev 3.12 ms per update on a 2,000-let program (017#pr2671 (also 001#issues); fixed)A recursive let's own name leaked into its free variables, so nothing from the Drawing library on was reused: every woods change re-ran all 610,670 steps; ~3 s of a figure move (004#reuse; fixed)The view's call memo cost more than it saved (8 entries per function, every call a miss, each paying for its key): a third of the view; woods figure size 6.1-7.3 s with the memo against 2.4-2.9 s without (004#memo; fixed)An open cell re-elaborated with fresh ids; the reuse check traced lexemes once per enclosing let (quadratic): about 2 s per change (122 slow checks of ~6,400-node subterms); GUI-only view 3.5 s against 1.2 s whole (008#reuse; fixed)The page checks the whole program for reuse on every dragged value's preview: about 40% of the page's time over a Full Body drag (profiled) (015#bridge; mitigated)Incremental evaluation saves nothing on a slider edit: Full Body 499 vs 464 ms from scratch, Witch 754 vs 701, Scenes 1,416 vs 1,453 (corrected 2026-10-13 to one protocol; conclusion unchanged) (009#reuse; open)Reuse works only per top-level binding, so nothing inside the picture is reused: incremental run skips 8-14% of a from-scratch run's steps; 75-84% of its steps are in calls whose inputs did not change (steps, checks free) (010#work; open)Every slider edit re-evaluates the whole figure, even when the picture does not change: 85-95% of a from-scratch run (Full Body, Witch); 85-92% for the 22 edits that change no shape; 85.2-89.0% (012); a position-keyed update would cost 0.0-1.7% (steps) (011#sweep (also 012#trace); open)Per-step reuse check, run where no reuse is possible: 8.0% inclusive (025#in-hazel-s-library-and-evaluator; open)Each run's new picture shares nothing with the last, so finding unchanged parts costs a whole walk: the merge 0.23 ms, as much as the whole view (0.24 ms), where a kept view would redo the neck's 17 shapes in 0.043 ms (5x less) (046#witch-share; open)incremental reuse checks (12)The recovering parser is quadratic on an unclosed bracket: 21-81 ms for well-formed modules, up to 1.8 s with an unclosed bracket (034#mudu; mitigated)Loading text the fast parser rejects: the fallback types it one character at a time, re-molding each time (quadratic): 182 s over 128 inputs; 8 KB of prose 64 s; 001 (with #2614): corpus 1,242 s, Kids' Choice 227 s (017#pr2610 (also 001#issues); open PR)The recovering parser inserts and re-grouts per character: parsing the 72 programs ~220 s; parse-heavy test groups 267 s (017#pr2614; open PR)Opening slides: building terms: 45 s of 213 s (about 21%) (020#timing; open)Opening slides: parsing: 41 s of 213 s (about 19%); Dynamic Row or Column 12.5 s, parsing 45% of it (020#timing; open)parsing on load (5)The undo history kept a whole editor state per edit, uncapped by default: ~92 MB per edit (014; 89.0 MB in 038); 1,048 MB after 12 edits; capped at 2, ~290 MB (020) / 284 MB (038); of 390 MB kept over 4 edits: types and statics 119 MB, ValueHash 98, terms 64, decoded replies 46, layout 41; #26 (014#update (also 014#what, 020#undo, 036#question, 038#space); fixed)An undo or redo rebuilt the program's syntax twice (RealizeView counted as an edit): undo 141 ms at 3,200 definitions, 263 at 6,400; redo 96 ms; a redo spent ~1.8x an edit's time in CachedSyntax.mk (038#twice; fixed)Compaction's price: restoring a compacted undo entry rebuilds its derived data: #2597: every redo 6.0-6.5 s against 2.7-3.1 s as built (014); undo 5.8 s, redo 6.1 s against a 6.9 s edit (038). #2635: redo 3.6-4.2 s (median 3.9), undos 3.5-5.1 s (014) or 3.6 s, 1.2-3.9 (038), against a 1.2 s edit (014#update (also 038#price); mitigated)The outline is rebuilt from scratch on every undo (its memo misses the restored program): 036: 211 ms, 15% of the profile, '~26 ms of each undo and redo' at 3,200 definitions. Corrected in 038 (2026-11-03 07:52): ~39 ms per undo at 3,200 definitions, 32-40% of an undo from 1,600 up (116 ms, 40%, at 6,400), ne (038#outline (also 036#twice, 036#where); open)The newest undo entry, kept whole for a fast undo, grows with the program: 0.55 MB at 400 definitions, 1.9 MB at 1,600, 6.9 MB at 6,400 (~1.1 KB a definition) vs ~0.01 MB compacted (038#persize; open)undo and history (5)Whole-program work on every edit (75)Every request sent the worker the whole elaborated program and its statics table: 478 KB of Marshal per request; encoding ~52 ms on the main thread, decoding ~22 ms in the worker (profiled) (001#pipeline; fixed)Each worker result was sent whole; marshaling it took as long as evaluating: 393 KB result; marshaling 44 ms against evaluating 48 ms; page decoding 14 ms (profiled) (001#now; fixed)The builtin Html type written out in every ascription; Macro uses closed over all builtins: a slide's request 609 KB (001#issues; fixed)After merging #2469 into #2635, a livelit release posted its changed definition whole, unshared: ~492 KB per release against ~16 KB shared; releases 20-30% slower (median 280 ms against 251.5 before) (020#merge469; fixed)The worker's sharing pass hashes every value of its answer and finds almost nothing to share: 1.4-1.6 s a result (2.0-3.4 s on an arms edit with its stream); 0 references found on the arms edits, 242 on the neck; after two changes 154-255 ms to save 0.46 -> 0.42 MB, more than encoding and decoding (046#witch-trip (also 046#witch-cuts); fixed)Hashing and encoding the request on the main thread: Full Body hashing 3.88-4.21 ms, encoding 1.96-11.22 ms per release (encoding moved with the heap, not the work) (013#question; mitigated)(agenda only) A request to the worker without sharing: Full Body after one retyped number 1.95 MB in 260 ms whole vs 26.8 KB in 4 ms shared; Kids' Choice 494 vs 52 KB (037#2-how-much-sharing-is-lost-passing-data-to-and-f; mitigated)Encoding the worker's answer with Marshal: 1.1-1.2 s for the 5.4 MB result (~0.22 s a MB) (046#witch-trip; mitigated)Decoding the worker's answer on the main thread, one long task (Marshal back, references resolved, every new value hashed): 1.4-2.0 s for the 5.4 MB result (trip run); 1.9-3.1 s (timeline run), at least 116 frames frozen; 1.3-1.5 s for a 4.4 MB stream; ~0.32 s a MB (046#witch-edit-parts (also 046#witch-trip); mitigated)Elaborations keep every source node's whitespace and comments, which nothing reads: requests 12-49% larger (five programs; probes.hz 48.0 vs 24.5 KB); 031: about a third of each program sent before #2608, and ~13.5% of the marshaled size still survives with it (through Typ.normalize) (017#prs (also 001#issues, 031#pr-2608); open PR)ValueHash's memo: a hash for every object, in a WeakMap of about two million entries: 98 MB (25%) of what four edits kept on #2597; 9.8 of 37.5 MB on #2635; stopped heap snapshots finishing (014#snapshots; open)Decoded worker results lose object identity, so identity-keyed memos miss: 0 of 192 blocks (Kids' Choice) and 60 of 137 (Full Body) came back as the objects decoded before; costs little at this size (037) (038#precompact; open)(agenda only) The first send with sharing costs double: Full Body 624 ms shared vs 308 ms whole (037#2-how-much-sharing-is-lost-passing-data-to-and-f; open)The worker encoding its result for the page: about a third of the worker's share of a woods change; result ~1 MB (004#cost; other)ShareCodec's tables of values shared with the worker build up between resets: #2635 keeps 9 MB after one edit, 94 MB after ten, then 46 MB; cap 200,000 entries (014#update; other)serialization (15)The evaluator re-applied itself to the run's five constants at every call (a closure per node, js_of_ocaml's generic call path): 30% of face view evaluation (~60 ms) (001#issues; fixed)Whole numbers carried back through Printf and big-integer parsing; tuple labels found by raising and catching an exception per label: about 2 µs a number; a list of 1,000 labeled points 8.2 ms back (045#diff; fixed)Converting a JS argument into Hazel at every call (no handles): 64x64 map 80.3 ms; 48.9 ms a call for a rule that ignores the map (029); 4,096 cells 66.5 ms converted each call (040) (029#report-27 (also 029#fix-world-passed, 040#handles); mitigated)A JS argument becomes Hazel syntax with a fresh id per node, is evaluated back, and is type-checked: time: 4,096 cells typed 139.2 ms, untyped 107.5 ms; 64 cells typed 1.49 ms (040#time; mitigated)The same boundary conversion: memory: 1,024 cells typed 80.4 MB a call, untyped 71.2 MB (040#space; mitigated)The evaluator under js_of_ocaml rather than wasm_of_ocaml: about 4x slower on fixed-precision work (001#next; open)Opening slides: js_of_ocaml's runtime with no Hazel caller: 14 s of 213 s (about 7%) (020#timing; open)The call boundary's floor: every call converts the whole JS argument to Hazel syntax, re-evaluates it, and checks its type: identity rule 8.54 ms at 16x16, 19.3 ms at 24x24; 13.8 ms vs 0.44 ms with no cells (~3 µs per node); the same rule in JS 0.003 ms (025#call (also 030#speed, 034#mudu); open)js_of_ocaml's generic calls in the evaluator's steps: caml_call_gen 7.9% + caml_call1 3.7% of self time (025#call; open)The least a call across the boundary costs, with a tiny argument: about 1 ms at every size (Hazel 1.27, Fumola 1.35 ms at 64x64); 0.889 ms vs 0.003 ms in JS (025) (027#numbers; open)js_of_ocaml turns each id's 16 bytes into a JS string by hand: about three quarters of minting an id (of the 46% above) (029#ids; open)A call into a Hazel rule in the game: 3.5 ms median vs Fumola 1.6 ms; a lever pull 13.7 ms with Hazel, 10.7 with Fumola, 9.7 with JS (032#events (also 039#speed); open)A Hazel event-handler call through hazeljs vs the same handler in JS: about 3.3 ms a call (3.2-3.4; p90 ~4 ms) vs 0.7 µs in JS; 2,000 steps ~7 s; boundary/evaluation split not measured (045: the interpreter alone 358 µs on this rule) (043#cost; open)js_of_ocaml's to_js, carrying the picture into JS: 0.88 ms of the 3.4 ms frame vs 0.08 ms building the same objects in plain JS (11x; different processes, rough) (046#witch-share; open)OCaml's Printf under js_of_ocaml for number formatting: Witch view 1.01 ms via Printf.sprintf vs 0.19 ms via toFixed (5.3x) (046#witch; other)the JS boundary (15)Building the request's statics projection walked both statics maps whole (first blamed on hashing): 001: 17 ms profiled, first given as 15 ms of hashing; corrected 2026-10-14: hashing 1-4 ms. 013: 1.9-11.9 ms per release (Full Body 11.64-12.22 ms) (013#numbers (also 001#now); fixed)Collecting streamed results re-indexed the whole elaborated program after every commit: 44 ms profiled per release (001#issues; fixed)The worker's answer carries its whole incremental cache, and the page sends it straight back: answers 86-98% larger than needed; one livelits answer 332 KB (017#pr2606 (also 001#issues, 005#fixes); fixed)The page rebuilt an index of the whole elaboration for each new evaluation: 204 ms of a 949 ms page update (profiled) (008#index; fixed)(agenda only) The worker reassembled the program from its pieces on every request: 47 ms on Full Body even when nothing changed (0.1 ms sent whole), 8 ms on Kids' Choice (037#2-how-much-sharing-is-lost-passing-data-to-and-f; fixed)The observation trace shipped to the page, where nothing reads it: 1.40 MB of the 5.4 MB result (1.27 MB the environments of 5 span-close events) (046#witch-answer; fixed)Each item's spine root carries the whole program below it, so the request grows with how deep the edit is: 3.6 ms at item 26 of 167, 20.8 ms at item 134; 808 vs 5,768 nodes copied (~46 per item above the edit) (013#left; open)Moving the livelit views into the worker makes the final picture wait for the trip: final picture +0.28 s later in UX mode (8 of 10 rounds) (016#release; open)The eval worker's own bookkeeping: WorkerMetrics.re 4.3 s + WorkerServer.re 6.2 s, about 10 s over 58 slides (020#timing; open)(agenda only) A one-literal edit re-sends about 10% of a chain of lets: about 10% of the program; every let around the edit hashes anew (042#1-undo-and-redo-in-o-log-n-in-space-and-in-time; open)the worker trip (10)The worker yielded with setTimeout after every 5,000-step slice; chained timeouts clamp to ~4 ms: 5.8-6.2 s of a ~10 s woods change idle between 1,292 slices (3.9-4.4 s evaluating) (004#timeline; fixed)Stream messages swamped the page (a full update per message): page busy 45.5 s after opening a 1,000-item program; 46.7 s for 2,000 (005#fixes; fixed)#2597 runs a full page update for every stream message, and its worker posts after every slice: 2,520 messages at ~140 ms each; Scenes first picture 287.5 s (12.5 s on #2635), Witch 173.1 s; worker idle 98.7% (007#why; fixed)Every preview in a drag makes the page recalculate: freeze 4.02 s per 1.5 s drag (~91 ms per input) (016#table; mitigated)scheduling (4)Values moved across boundaries (44)Each id minted by copying a byte buffer to a string; polymorphic compare on ids, names, ints: face view evaluation ~61 ms median (~58.5 ms min) (001#issues; fixed)(agenda only) Two slides were never sent in pieces: livelit annotations reused the signature's ids, so the whole program was re-encoded every request: ~200 ms a request on Full Body, ~55 ms on Kids' Choice (037#2-how-much-sharing-is-lost-passing-data-to-and-f; fixed)(agenda only) Fresh ids for an item's body hole on every analysis made undo miss the worker's memo: undo/redo 40-55 ms; an undo posted 7 KB instead of ~130 bytes; Kids' Choice undo still 15.8 ms (037#2-how-much-sharing-is-lost-passing-data-to-and-f; fixed)Making ids for every term the way back makes: 906 ids took 0.29 ms, 'almost half' of the way back. Corrected 2026-11-07 07:40: Id.mk is a counter, not a random UUID; the cost was eight string concatenations per id (from 7a5667e6f2 on #2635's line, which dev lacks) (045#ids (also 045#boundary); fixed)Minting fresh ids: 46% of a list loop's profile (sumbuild(1000): 1,158 of 2,508 ms); 4% of a plain loop (029#ids; mitigated)The evaluator gives a fresh 16-byte id to every node it builds: 461,422 ids to build a 33,847-node woods picture (7,650 distinct); a slider edit mints 84,528 to 423,362 (009#evaluation; open)Fresh ids make worker messages bigger: results 11% larger (387,625 vs 347,920 slots); requests 1.99x (43,248 vs 21,728) (009#wire; open)Analyzing an item again renames what statics adds; the change spreads up the chain of lets: 667 of Full Body's 111,462 nodes renamed, changing 692 hashes; 6,055-18,637 ids a slider edit; the reuse check falls back to comparing structure (105 parts vs 46) (009#statics; open)Id.mk mints a UUID per node (Uuidm.v4's byte copy under js_of_ocaml): Id.mk ~20% of all time; of_js 10% of the floor; the top self-time entry is caml_subarray_to_jsbytes (025#call; open)Comparing ids (Id.compare) inside the walks: 134 ms, 10% of the profile (036#where; open)When ids change, the reuse check compares terms in full: incremental evaluation 7-15 times slower than fresh on Hands and Eyes (004#casts; other)ids on every term (11)The evaluator unrolled the recursive Html type (47 constructors) at every Html node: a sixth of the page's time in the woods; an uncached check another 5% (004#casts; fixed)Giving a value a type rebuilt it whole at every typed boundary, and the call memo re-keyed the copies: woods picture (15,500 nodes) copied; about a quarter of the view every redraw; memo keys copied the picture three times per change (006); 2,000 tuples passed 30 times 382 ms (dev microbenchmark) (004#update (also 006#update, 017#pr2679); fixed)#2681's type memo is asked at every part of every fresh argument (all misses), raising the floor: floor 8.54 -> 10.1 ms at 16x16 (+18%; +9% in the floor driver); per call 4,137 memo lookups (all misses), 2,580 writes, 6,734 type-hash lookups (025#floor; fixed)A list loop re-types its whole list every iteration (an ascription pushed through every element, a fresh term and id each): building and summing 3,000 numbers 4,591 ms vs Fumola's 24.7 ms (186x); mapinc 103x; 60% of sumbuild(1000)'s profile inside Ascriptions.re (029#re-type; fixed)Ascribing a constructor application compares two copies of the same sum type in full (the Html type, at every node of a view): Polygons click 15-17 s profiled, the ascription step 88% of it; dev benchmark 74.5 ms (017#pr2661 (also 001#issues); open PR)A recursive function with an annotated list parameter re-walks its whole argument at every call (quadratic): 205 ms at 400 elements (017#pr2681; open PR)An annotated recursive helper is re-checked over the rest of the list at every step (quadratic walk): shipped World rule 144 ms at 16x16 vs 18 ms unannotated; 678 vs 40.8 ms at 24x24; 58.6% of a deep find's profile in Ascriptions.transition_multiple (025#quadratic (also 034#mudu); open PR)The same ascription re-checks inside the woods picture's view: memo off vs whole memo 2,823 vs 2,416 ms (runner 1), 2,601 vs 2,214, 2,061 vs 1,749 ms (~14-16%) (025#woods; open PR)Pushing the parameter type through the whole argument record, a fresh Asc node and id per element: 16% of the floor of a 16x16 call (025#call; open)The parameter's type annotation is re-checked against the converted value on every call: a typed call about 2.8x an untyped one, even with direct conversion (040#time; open)type checks at run time (10)Every livelit use evaluated the whole livelit definition, then copied it unshared: Shoes and Hair analyze 4.3 s (001#issues; fixed)Finished livelit definitions and views: every helper copied into every closure, per event and per redraw: Kids' Choice release 4.6 s; Polygons click ~11 s (001#issues; fixed)A function Hazel's JS library returns has its environment substituted into its body, so a held list is re-evaluated at every call: h_ref 0.234, 1.14, 3.94 ms for held lists of 100, 1,000, 3,000 vs Fumola ~0.291 ms (029); 4,096 numbers held: 5.31 ms and 29.0 MB a call; World rule 90 ms a move at 64x64 (040) (029#re-walk (also 040#held); fixed)Applying a handler with Evaluator.evaluate, which closes its answer, copies what the closure closes over: 63 ms a call, 175x evaluate_open (358 µs) (045#hand; mitigated)Variable lookups, environment frames and ascriptions mint most of the evaluator's ids: variable lookups 38%, environment frames 20%, ascriptions ~30% of ids minted (009#ids; open)A value held in a closure is re-stepped when substituted into each call: walk to index 0 still O(L): 7.319 ms at L=1024, 1.443 ms at L=256; converting the map once into a closure 24.8 ms at 16x16 (025#t-steps; open)Environment lookups: 7.2% of a loop, 2.3% of sumbuild, 0.2% of h_ref (035#where; open)The picture written out afresh in each of four samples (substitution makes each copy new, so even the encoding cannot share them): probes 0.34-0.35 MB of the 0.42 MB answer after the changes (046#witch-cuts; open)environments (8)The splice's value carried back to Hazel and in again: 20 of the 21 ms of the Witch picture drawn from JS (046#witch-45 (also 045#direct); fixed)The evaluator visits values that are already final (values are expressions): a third of a loop's passes take no step (count(1000): 14,009 passes for 9,007 steps); h_ref(3,000) 3,008 passes for one reference (029#fix-fast-path; mitigated)The way back: a compiled view's answer made again as Hazel terms: 0.27 ms of a 0.34 ms compiled render (79%), against 0.037 ms in (11%); the answer has 861 nodes vs the model's 115 (045#boundary; mitigated)Carrying a changed value back into Hazel whole: a list of 1,000 labeled points 5.76 ms (5.76 µs a point; a third of a 16.7 ms frame) (045#diff; mitigated)Re-stepping the converted argument: of_js builds unevaluated syntax the evaluator steps back into the value it was: 56% of the 13.8 ms floor of a 16x16 call (025#call; open)Sending closed, first-order values as Hazel terms (ids on every node, a sharing table): the Witch's picture 142.2 KB, 24.0 ms to encode and decode as terms vs 48.0 KB, 6.09 ms as data (3.0x smaller, 3.9x quicker); all 108 samples 275.9 KB as terms vs 144.7 KB as data (047#exp1; open)Converting a value term to data after the fact: 110.0 ms for the picture (templated from data/hazel-exp1.json; 276.3 ms for all samples). Caveat: the text says the first, quadratic version took 110 ms and was fixed, yet the filled value is also 110.0, so the post-fix (047#exp1; other)values are terms (7)Auto-probe rebuilt the whole top level's skeleton every frame (memo keyed on a segment every edit replaces): 244 ms, 13% of the profile (036#fix-root; fixed)A probe's environment written out whole: the Drawing module in the sample of a probe whose value is a few bytes: result 5.4 MB for a 10 KB request (~536x); probe samples' environments 4.14 MB (77%); Drawing alone 3.8-3.9 MB (~70%), kept because an explicit probe keeps every name its expression uses and Sample.Env.elide substitutes (046#witch-answer (also 046#witch-cuts); fixed)The evaluator's live-feature stages (state merge, reuse check, probe sample, effects) run on every pass, even with no feature in use: 25.0% of a loop, 43.6% of h_ref(3,000); with the trampolines 37% of a loop and 66% of h_ref; the rule itself 7% (029#hazel-step (also 035#where); mitigated)Per-step state merge, run with no live feature in use: 8.1% inclusive (025#in-hazel-s-library-and-evaluator; open)Per-step probe sampling, run with no probes: 6.8% inclusive (025#in-hazel-s-library-and-evaluator; open)Samples' environment copies in retained memory (a code comment, not measured in the series): once about 80% of retained memory (047#why; other)probes and samples (6)Values held as terms (42)Evaluating a livelit's view on the page: about 50% of the page's main thread, about 69% counting the GC it causes (005#update; mitigated)Hazel walks the same list more slowly than Fumola: 64x64 passed 346 vs 145 ms (2.4x), held 254 vs 26.3 ms (9.7x) (027); 341 vs 148 ms (2.3x), 261 ms of it walking (~64 µs a cell), held 256 vs 28.7 ms (8.9x) (029) (027#numbers (also 029#report-27); mitigated)A livelit view on Hazel's interpreter (Polygons): a render 13.7 ms on the interpreter vs 0.34 ms compiled, warm, with the trip in and out (40x); the compiled call alone 0.043 ms (315x); Petri rule 7.19 vs 0.011 ms (630x); recursive sum of 1,000 47.9 vs 0.042 ms (1,152x) (045#speed; mitigated)A small rule on Hazel's interpreter vs compiled code: 358 µs a call (evaluate_open) vs hazel-jit 1.59 µs, hand-written JS 0.90, ReScript 0.55, Melange 0.46 µs (225x hazel-jit) (046#speed (also 045#hand); mitigated)The Witch picture's view on the interpreter: Hazel test: a frame 155 ms (6 fps) vs 3.4 ms compiled (45x), most of it the command evaluating the splice's value; Firefox: 87 ms (11 fps) vs 3.0 ms (29x); polygon editors 26-29 ms vs 0.29-0.45 ms. Corrected 11-07 13:28: (046#witch-frame (also 046#witch-firefox); mitigated)Evaluating the face's own view, the largest single cost left: ~70 ms per release (001#next; open)The evaluator's own work in the view (variable lookups, pattern matching, fresh ids): about 500 ms of the woods view (004#update; open)Opening slides: evaluation: 10 s of 213 s (about 5%) (020#timing; open)Each evaluation step costs about 3 µs: ~3 µs a step; a plain walk 25-80 µs per cell; countdown 128 steps 3.836 ms (3.162 ms after the PRs, -18%) (025#call; open)Each Hazel evaluator pass costs far more than a Fumola step: ~2.6 µs per Hazel pass vs ~0.13 µs per Fumola step, 'some 20 times as much' (029's body); the series index, 035 and 047 say 'about 15 times'. Net Fumola 10x faster on the loop, 6.5x on calls (029#steps (also 035, 047#experiments); open)Building the World map: three list walks at the per-pass cost: 1,539 ms at 64x64 (order check 662, count 286, build 927); 60-70 µs a cell; set-up 2,136 ms vs Fumola's 326 (~6.5x) (029#fix-game-map (also 030#setup); open)The program's run on the evaluator in the worker: 1.2-2.6 s of a 5.3-8.8 s small edit (18-20%, 1.1-1.3 s on the neck edits); after two changes 1.0-1.1 s (44-56%); with sharing dropped 0.81-0.92 s (50-64%), now the largest cost (046#witch-edit-parts (also 046#witch-trip, 046#witch-cuts, 047#goal); open)interpretation itself (12)ValueHash keeps hashes in a JS WeakMap side table that slows as it grows: identical woods evaluations 2.3, 5.5, 6.3 s in one session (17.2 s after two slides) as the heap grew 685 MB -> 1.2 GB; corrected 2026-10-13: the '23 times slower' was the table, not derived names (009#merkle; fixed)Garbage collection during view evaluation: 21% of the page's main thread (005#update; open)Garbage collection in the boundary floor and in a plain walk: 18% of the floor (with 'the rest'); 19.8% of self time in a held-list walk; 2.45/2.54/2.39 ms per identity call (025#floor; open)Garbage collection on every pass (a trampoline closure, a state record, a fresh term per result): 36% of a loop's profile (count(5000): 1,032 of 2,836 ms); 15.8% of sumbuild(1000); 13.7% of h_ref (029#hazel-step (also 035#where); open)Garbage collection and the rest, in the undo probe: 370 ms, 27% (375 ms, 21% before) (036#where; open)Whole-program memos (Statics.mk keeps 16 programs, MakeTerm 8 parses) fill up: about 19 MB per edit until they reach their bounds (014#caches; other)The same compiled view runs 6x slower inside Hazel's process (likely its heap and GC): 1.16 ms vs 0.19 ms in a benchmark process (046#witch-frame; other)allocation, GC (7)Eight fresh stage closures per node; pass-through stages add trampoline bounces: call-heavy benchmark 499 ms min, 607-644 ms median before; agenda 037: dev takes 206,834 steps on the PerfBudgets program against 96,438 on #2635 (001#next (also 037#3-why-2635-s-evaluator-takes-half-dev-s-steps-on); fixed)The trampoline in the evaluator's steps: trampoline run 3.5% + bind 2.6% of self time (025#call; open)Trampolines for stack safety (about five closures and continuations per pass): 11.7% of a loop, 22.4% of h_ref, 3.5% of sumbuild (035#where; open)The stack overflows on long let chains and large modules: Stack_overflow at 8x Common (184 lines) after an edit (032); ~150 module members overflow Node's default stack (034, 039); the undo probe at 6,400 definitions crashed 4 of 6 runs with an 8 MB stack (036) (032#scale (also 034#release-found, 036#method); open)trampolines (4)The picture is a flat list of shapes in absolute coordinates, so moving a part moves every point: one slider changes up to 113 of 133 shapes (a group tree: at most 14 nodes); arm-angle trace distance 20,206 vs 5,104 steps on the tree (011#representation (also 012#scratch); open)Walks over the picture's lists rerun down to the last changed shape: lists as named cells would take 10.1% off the update (to 1,509,299 steps over 63 edits); 0.6 points median, at most 5.1 (011#cells; open)Hazel has no map, so a rule walks a list to find a square: 254 ms at 64x64 held, 346 ms passed, against Fumola's held HashMap at 0.54 ms (471x and 641x) (027#numbers; open)A game rule scans a list each call (no map): 0.7 ms per pull with 10 links, 5.7 ms with 100, 65 ms with 1,000 (020#play; other)data layout (4)Paying for the editor ever (27)Jumping to a projector walked the caret token by token: ~190 ms per projector click (001#issues; fixed)Slide code found the head's frame per point instead of once: Eyes sliders 1.5-1.8 s (002#face; fixed)Autosave prints the whole program inside the change; with probes the print was quadratic in top-level items: about 600 ms a change (whole program) and about 1 s (GUI only); updated 2026-10-14 from 0.55 s (008#update; fixed)The app evaluated the whole livelit definition on every event before applying its update: 68.3-83.3 ms per event for the Polygons livelit (its update alone 0.67-5.18 ms); a drag step 80.7 ms (045#diff; fixed)Hands redraw grows with the finger count (not profiled): about 0.3 s per finger; 99 fingers 32.30 s against 5 ms in the game; 100 claws 8.19 s (003#cost; open)The library's size and load: hazel-lib.js 2.8 MB; page load ~525 vs 270 ms (Hazel vs JS); heap 67 vs 51 MB; 643 KB over the wire (034) (025#t-game (also 034); open)Hazel's tiles in the game: a whole Hazel app per script box, made one at a time: ~3.7 s for six boxes (3.0-4.5 s); the run ~4 s longer than with JS (17.4 vs 13.1 s) (032#table; open)hazel-jit's own output: an array per call of a tuple function, generic equality, no loops for tail calls, boxed options: 1.59 µs a call, 2.9x ReScript's 0.55 µs; 9% behind ReScript on the Witch view (046#speed (also 046#suggests); open)other (8)Other (8)fixed (on some branch): 59mitigated: 28a fix in an open PR: 8open: 88unknown, bounded or n/a: 13
A treemap (Ben Shneiderman's; laid out as in ^report(47)): every rectangle is one cost a report measured, all the same size, so the area of a group is how many costs it holds. Hover a rectangle for the cost, its number and its report. The measurements differ in workload and units, so the rectangles count costs; they do not weigh them.

59 costs are fixed somewhere and 28 mitigated; 8 have a fix waiting in an open PR; 88 are open; 13 are unknown, bounded by design, or not a cost of the app. The fixed ones are mostly not on dev (below).

The four families#

Values held as terms (42 costs)#

A closed, first-order value pays for what a term can be: open, holed, a closure.

Whole-program work on every edit (75 costs)#

An edit to one literal redoes work proportional to the whole program, and sometimes to its depth exponentially.

Values moved as terms across boundaries (44 costs)#

A value leaving the evaluator is encoded with all its ids, and was hashed node by node to find what the other side held. On the Witch slide, the worker's answer going to the page was 70 to 72% of a small edit: shared in 1.4 to 1.6 s, encoded in 1.1 to 1.2 s, decoded in 1.4 to 2.0 s with the page frozen (^report(46), the trip). As data instead of terms, the slide's picture is 3 times smaller and 2.5 to 3.9 times quicker to send (^report(47), experiment 1).

An interpreter that pays for the editor at every step (27 costs)#

Every term the evaluator visits, values included, goes through state merging, a reuse check, probe sampling and recording effects before its rule. On a loop, the rule itself is 7% of the time; garbage collection is 36%, and the stages and their trampolines 37% (^report(29)).

The largest costs#

Each of these alone was most, or a large part, of the work it was found in. Shares are of their own workload, so they do not add across rows.

sharethe costmeasured onreportwhere it stands
88%the ascription step, comparing two copies of the same sum type in full, in a click on the Polygons editor (15 to 17 s)the livelits branch17#2661, open: under 6%, the click 2 s; on dev's benchmark 75 to 60 ms
85 to 95%of a run from scratch, re-evaluated on every slider edit, because the whole figure is one binding that depends on every sliderFull Body and the Witch11open
79%a compiled render's trip back, the view's answer made Hazel terms again (0.27 of 0.34 ms)Polygons, in Node45mitigated in the app: the answer drawn straight from JS (^ticket(714)), model to page 0.79 to 0.38 ms
77%of the main thread while a slide loads: the code editor's view of the whole program, rebuilt on every update#2597, Scenes7open on #2597
75 to 84%of the steps an incremental run takes are in calls whose inputs did not changethe livelits slides10open
70 to 72%of a small edit: the worker's answer to the page, shared, encoded and decodedthe Witch, Firefox46fixed on a trial branch: the edit 1.3 to 1.7 s
71%of the page's main thread during two changes: evaluating a livelit's view (50%) and the garbage it made (21%)the livelits branch5mitigated (median 2.20 to 1.41 s, ^report(4)); views compiled since (^report(45))
60%of building a list of 1,000 numbers, inside Ascriptions: the list's type pushed over it again each iterationa library build off dev29fixed on a trial (^ticket(548)): 6,135 to 693 ms, linear; not a PR
58.6%of a deep find, in transition_multiple under matches_innera library build off dev25#2681 open; on a trial 144 to 20.6 ms
56%of the floor of a call that does nothing: re-stepping the argument, converted to syntax with fresh idsa library build off dev25open (a proposal: conversion makes final values)
46%of a list loop: minting fresh ids, three quarters of each a by-hand copy of 16 bytes into a JS stringa library build off dev29mostly avoided in that loop on a trial (^ticket(548)); cheaper ids for dev in #2816, open
40%of a Full Body drag: a whole-program reuse check on every previewthe livelits branch15open; partly mitigated by coalescing previews (^report(16))
38%of an edit at 3,200 definitions: rebuilding the top-level term (statics' walk 20%, layout 6%)#263536open
37% and 36%of a loop: the editor's stages and their trampolines, and garbage collection; the rule itself, 7%a library build off dev29open

How the costs multiply#

The costs are not only many; they make one another larger, so removing one can be worth more than its own share.

  1. The Witch's answer. A probe keeps every name its expression uses; substitution writes each out whole; so a module became 3.8 MB. The sharing pass then hashed every value of that answer and found almost nothing to share; encoding and decoding scaled with its size, and decoding froze the page. Cutting the module and the trace gave 2.2 to 3.2 times; dropping the sharing, 2.9 to 4.6 times in all; and the evaluator's own time fell too, unexplained (^report(46)).
  2. A list loop. A type pushed over a growing list each iteration (quadratic), a fresh id for every part it touches (each id three quarters a JS copy of 16 bytes), then the garbage of all of it: the gap to Fumola grows with the list, to 186 times at 3,000 numbers (^report(29)).
  3. Closures. A closure's environment is substituted into its body, so a value it holds is walked again on every call: 5.31 ms and 29 MB a call at 4,096 numbers (^report(40)).
  4. Nesting. Whole-program work inside per-item work becomes quadratic, and nested analysis exponential: nested functions' statics exponential in their depth, 5.3 s at eight levels (^report(17)).
  5. One binding, many sliders. Reuse works per top-level binding, and a picture is one binding over every slider, so a step of any slider re-evaluates 85 to 95% of the run, even when nothing in the picture changes (^report(11)).

One small edit, change by change#

A slider's step on the Witch slide took 4.2 to 6.5 s to show in the picture; two changes and the sharing dropped bring it to 1.3 to 1.7 s, still 80 to 103 times the 16.7 ms of a 60 fps floor. Matthew's goal (2026-11-08): "a floor of 60FPS for small edits (sliders changing), just like in JS"; "and each obstacle is worth studying, and overcoming." Each change so far removed the largest obstacle and exposed the next.

Update, 2026-11-08 evening: the next change, the slide's run compiled to JavaScript and run in the page at the slider's event (^report(49), a step, run compiled): the run takes 10 to 12 ms, and on the two steps away from a slider's starting value the picture showed at the page's first redraw, 318 and 469 ms after the step, the last bar below. On the two steps back it still waited for the worker (1.66 to 1.69 s), not yet explained. Now the page's own work is the largest obstacle: statics and the whole slide's view, drawn twice before the first redraw (where a step's time goes now).

A slider's step on the Witch slide, from the edit to the picture showing it, in Firefox: each change so far, and the goal (a log scale)before the changesbefore the changes: 4.2 to 6.5 s (run 42486001354)4.2 to 6.5 s, 250 to 391 times the goala module kept out of a probe's environment, the trace cleareda module kept out of a probe's environment, the trace cleared: 1.9 to 2.4 s (run 42490487136)1.9 to 2.4 s, 111 to 143 times the goalthe worker's answers unsharedthe worker's answers unshared: 1.3 to 1.7 s (run 42492117212)1.3 to 1.7 s, 80 to 103 times the goalthe run compiled in the page (report 049)the run compiled in the page (report 049): 0.3 to 0.5 s (run 42551267058)0.3 to 0.5 s, 19 to 28 times the goalthe goal: 60 fps16.7 ms a step0.01 s0.1 s1 s10 s
The same eight edits each time (two sliders, both ways, compiled views on and off), Firefox on GitHub's machines, ^report(46)'s runs: 42486001354, 42490487136, 42492117212. The last bar (added 11-08 evening) is ^report(49)'s run 42551267058: the two of its four steps, compiled, whose picture came from the run compiled in the page; the other two still waited for the worker (1.66 to 1.69 s), and with nothing compiled the same steps took 1.90 to 2.24 s in that run.
Where a small edit's 1.42 s goes now (arms (up / down) 55 to 65, views on), against the goal's 16.7 msthe worker's evaluator: 916 ms916 msthe worker's evaluatorthe page, before the request (update, view, statics): 157 ms157 msthe page, before the request the page, after the answer (views drawn again): 135 ms135 msthe page, after the answethe worker's other work: 115 ms115 msthe worker's other workthe answer encoded: 81 ms81 msthe answer encodedthe answer decoded: 20 msthe goal: 16.7 msthe goal,16.7 ms,same scale
The median of the eight edits after the changes (run 42492117212), laid end to end as ^report(46) does (the page's and the worker's timelines), drawn as a treemap: each rectangle's area is its time, and the green square is the goal's 16.7 ms on the same scale.

What is left, by size: the worker's evaluator, then the page's own work (most of it the whole slide's view drawn again), then the answer's trip. None of the three is small enough alone; all three have to go.

Where the fixes are#

Most fixes in the ledger are on the livelits branches (#2635, #2597) or on trial branches; of the PRs against dev it names, two are merged, #2602 and #2679, and nine are open: #2603, #2608, #2610, #2614, #2661, #2671, #2675, #2681 and #2689. So dev pays most of these costs today. Dev also pays more for the worker's answer than the branches measured: it sends the run's final state as it is, the incremental cache and the trace included, and the cache comes back with the next request (^report(47)).

Beside Fumola#

Hazel's evaluator takes about half the steps Fumola's machine takes, and each costs about 20 times as much: 2.6 µs a pass against 0.13 µs a step. Net, Fumola is 10 times faster on a loop and 6.5 times on calls (^report(29)). Fumola keeps its values apart from its terms, with no ids in them, and its first-order values serialize as they are (^report(47), beside Fumola's Value).

Recommendations#

In order of what they cost to do: first merge what is already built and measured, then port what the branches proved, then change the three choices that make most of the costs, and track the goal in CI as each lands.

1. Merge the performance PRs already open against dev#

Most are reviewed in ^report(17) with their reasons to wait; each has a measured gain, most on dev itself. States on GitHub, 2026-11-08.

PRwhat it doesmeasuredfamily
#2603a let analyzed once unless it refers to itselfnested functions' statics 5.3 s to 13 ms at eight levels; real programs 20 to 30% faster (dev)whole-program work
#2673an unchanged expression recognized by its Merkle hashre-evaluating after an edit in a 400-definition program, 2.7 s to 0.41 s (dev)whole-program work
#2610, #2614text the fast parser rejects parsed without going quadraticthe 72 programs parsed in 87 s instead of about 220; the parse-heavy test groups 142 s instead of 267 (dev)whole-program work
#2651a module binding's definition analyzed once, not twice1.8 s of one slide's 4.2 s of statics (livelits branch)whole-program work
#2675a recursive let's free variables reported right, so reuse works around itno timing on dev; on the livelits branch the woods slide reuses its code after a figure movewhole-program work
#2661, #2681types hashed, consistency asked once per pair; a value known to have a type not walked againdev's benchmark 75 to 60 ms; an annotated list parameter at 400 elements, 205 to 33 ms (dev); a Polygons click 15 to 17 s to 2 s (livelits branch)values held as terms
#2606the incremental cache kept in the worker, not sent to the page and backanswers 86 to 98% smaller (dev)values moved across boundaries
#2608the source's whitespace and comments left out of elaborationsrequests 12 to 49% smaller (dev)values moved across boundaries
#2671an unchanged piece of the program kept as the same object3.1 to 1.9 ms an update at 2,000 lets (dev); a Kids' Choice slider release 1.5–1.7 s to 0.7–0.9 s (livelits branch)whole-program work
#2652the worker started at load, and an answer already queued not timed outslides that drew nothing in Firefox draw (a fix, not a speed-up)values moved across boundaries
#2816ids minted and compared as strings, one concatenation an idas on the livelits line since 7a5667e6f2 (^report(45)); not yet timed on devvalues held as terms

Merged already: #2602, #2672, #2678 (CI fails when an evaluation exceeds its step budget) and #2679 (a value crossing a typed parameter no longer copied: 382 to 268 ms). Known conflicts, from ^report(17): #2610 with #2614 (merge one, rebase the other), #2661 with #2679 (resolved in #2681), #2673 with #2681, and Andrew's #2469 with #2603, #2606 and #2614.

2. Port what the branches measured#

3. Change the three choices behind most costs#

4. Track the goal on dev#

A small edit's time, from the edit to the picture, on a dev slide in Firefox on GitHub's machines, for every PR, against 16.7 ms. CI already fails a PR whose evaluation exceeds its step budget (#2678); steps do not show the trip, the page's view or the garbage. The Firefox check that measured the Witch (scripts/jit_slides.py --edit, on the livelits line) can run on dev's slides.

The ledger#

Every cost, by family and root cause, with its number, what it was measured on, its report, and where it stands. Open a group to see its costs. Numbers are as the reports state them, corrected values where a report corrected itself; measurements differ in program, machine and branch, so compare within a row, not across rows.

Values held as terms: ids on every term (11)
the costwhat it costsmeasured onreportwhere it stands
Each id minted by copying a byte buffer to a string; polymorphic compare on ids, names, intsface view evaluation ~61 ms median (~58.5 ms min)Kids' Choice face view, #2635, in-page probe001#issuesfixed on #2635 (7a5667e6f2; 045#ids says dev does not have it): ~61 -> ~60 ms median, ~58.5 -> ~53.5 ms min
When ids change, the reuse check compares terms in fullincremental evaluation 7-15 times slower than fresh on Hands and EyesNode test harness that re-ran statics (not the app)004#castsharness only; the app has the same trap whenever ids change (see 008#reuse)
The evaluator gives a fresh 16-byte id to every node it builds461,422 ids to build a 33,847-node woods picture (7,650 distinct); a slider edit mints 84,528 to 423,362Scenes woods and slider edits on Full Body, Witch, Scenes; Node, #2635009#evaluationopen; a local experiment with content-derived names removed 92-97% of ids at 11-31% more time
Fresh ids make worker messages biggerresults 11% larger (387,625 vs 347,920 slots); requests 1.99x (43,248 vs 21,728)8 woods figure moves, headless Firefox, #2635009#wireopen
Analyzing an item again renames what statics adds; the change spreads up the chain of lets667 of Full Body's 111,462 nodes renamed, changing 692 hashes; 6,055-18,637 ids a slider edit; the reuse check falls back to comparing structure (105 parts vs 46)5 Playground slides analyzed twice, Node, #2635009#staticsopen; naming two sites took renames from 667 to 85 (local)
Id.mk mints a UUID per node (Uuidm.v4's byte copy under js_of_ocaml)Id.mk ~20% of all time; of_js 10% of the floor; the top self-time entry is caml_subarray_to_jsbytesas above (dev build profile)025#callopen on dev (cheaper Id.mk proposed; done on the hazel-jit trial line, 045#ids)
Minting fresh ids46% of a list loop's profile (sumbuild(1000): 1,158 of 2,508 ms); 4% of a plain loopsumbuild(1000), count(5000), Node, embed-520's dev build029#idsmostly avoided in that loop by ^ticket(548); cheaper ids open on dev
Comparing ids (Id.compare) inside the walks134 ms, 10% of the profilesame profile, #2635036#whereopen
(agenda only) Two slides were never sent in pieces: livelit annotations reused the signature's ids, so the whole program was re-encoded every request~200 ms a request on Full Body, ~55 ms on Kids' Choicesame probe, #2635037#2-how-much-sharing-is-lost-passing-data-to-and-ffixed on #2635 (c079fa2e24): 1.8 ms and 0.3 ms
(agenda only) Fresh ids for an item's body hole on every analysis made undo miss the worker's memoundo/redo 40-55 ms; an undo posted 7 KB instead of ~130 bytes; Kids' Choice undo still 15.8 mssame probe, Full Body, #2635037#2-how-much-sharing-is-lost-passing-data-to-and-ffixed for Full Body (ab7273c984, derived ids): 0.7 and 0.6 ms; open on livelit slides
Making ids for every term the way back makes906 ids took 0.29 ms, 'almost half' of the way back. Corrected 2026-11-07 07:40: Id.mk is a counter, not a random UUID; the cost was eight string concatenations per id (from 7a5667e6f2 on #2635's line, which dev lacks)Polygons render, Node, trial/694-view-jit045#ids (also 045#boundary)fixed in Id.mk (one concatenation an id): 0.044 ms, 16% of the way back
Values held as terms: run-time type checks (ascriptions, casts) (10)
the costwhat it costsmeasured onreportwhere it stands
Ascribing a constructor application compares two copies of the same sum type in full (the Html type, at every node of a view)Polygons click 15-17 s profiled, the ascription step 88% of it; dev benchmark 74.5 msPolygons editor click, #2635; dev's 20-constructor sum builder017#pr2661 (also 001#issues)fix #2661 (Merkle-hashed types) open to dev: click 15-17 -> 2.0-2.2 s, step under 6%; dev 74.5 -> 60.5 ms
The evaluator unrolled the recursive Html type (47 constructors) at every Html nodea sixth of the page's time in the woods; an uncached check another 5%Scenes slide, woods, ^picture view, #2635, Gecko profile004#castsfixed (efaaee244f): figure size 2.6-3.5 -> 2.0-3.1 s
Giving a value a type rebuilt it whole at every typed boundary, and the call memo re-keyed the copieswoods picture (15,500 nodes) copied; about a quarter of the view every redraw; memo keys copied the picture three times per change (006); 2,000 tuples passed 30 times 382 ms (dev microbenchmark)woods ^picture view, #2635; dev microbenchmark004#update (also 006#update, 017#pr2679)fixed by #2679, merged to dev 2026-10-19: view 725-830 -> 520-650 ms, redraw median 1.62 -> 1.41 s; 382 -> 268 ms; Scenes view 20-25% faster (778 -> 585 ms)
A recursive function with an annotated list parameter re-walks its whole argument at every call (quadratic)205 ms at 400 elementsmicrobenchmark, dev017#pr2681fix #2681 open: 33 ms
An annotated recursive helper is re-checked over the rest of the list at every step (quadratic walk)shipped World rule 144 ms at 16x16 vs 18 ms unannotated; 678 vs 40.8 ms at 24x24; 58.6% of a deep find's profile in Ascriptions.transition_multipleDress Up's World rule via hazel-lib.js (dev-based #2719), Node, laptop025#quadratic (also 034#mudu)fix #2681 open; on a trial: 144 -> 20.6 ms (7.0x), 678 -> 42.8 ms (15.9x)
The same ascription re-checks inside the woods picture's viewmemo off vs whole memo 2,823 vs 2,416 ms (runner 1), 2,601 vs 2,214, 2,061 vs 1,749 ms (~14-16%)Scenes woods program, Test_PicView, trial/2635-memo-depth, GitHub runners025#woodsfix #2681; a depth-1 memo keeps 82-96% of the gain
Pushing the parameter type through the whole argument record, a fresh Asc node and id per element16% of the floor of a 16x16 callas above (dev build profile)025#callopen
#2681's type memo is asked at every part of every fresh argument (all misses), raising the floorfloor 8.54 -> 10.1 ms at 16x16 (+18%; +9% in the floor driver); per call 4,137 memo lookups (all misses), 2,580 writes, 6,734 type-hash lookupsidentity rule, trial/r25-2681, Node, laptop025#floorfixed on trial/r25-2681-depth (depth-1 limit): floor 8.53 ms, rule 18.9 ms
A list loop re-types its whole list every iteration (an ascription pushed through every element, a fresh term and id each)building and summing 3,000 numbers 4,591 ms vs Fumola's 24.7 ms (186x); mapinc 103x; 60% of sumbuild(1000)'s profile inside Ascriptions.resumbuild/mapinc kernels, Node laptop, trial/r25-best; profile on embed-520's dev build029#re-typefixed on trial/r25-asc (^ticket(548)): 6,135 -> 693 ms (8.9x), linear; not a PR
The parameter's type annotation is re-checked against the converted value on every calla typed call about 2.8x an untyped one, even with direct conversionsame benchmark, lib-floor040#timeopen (#2681's work)
Values held as terms: environments and substitution (8)
the costwhat it costsmeasured onreportwhere it stands
Every livelit use evaluated the whole livelit definition, then copied it unsharedShoes and Hair analyze 4.3 sShoes and Hair slide001#issuesfixed on #2635 (54543edc6b): 2.0 s
Finished livelit definitions and views: every helper copied into every closure, per event and per redrawKids' Choice release 4.6 s; Polygons click ~11 sKids' Choice, Polygons, #2635001#issuesfixed (d706d4d1ec): 4.6 -> 1.6 s; Polygons -> 0.17-0.19 s
Variable lookups, environment frames and ascriptions mint most of the evaluator's idsvariable lookups 38%, environment frames 20%, ascriptions ~30% of ids mintedas above009#idsopen
A value held in a closure is re-stepped when substituted into each callwalk to index 0 still O(L): 7.319 ms at L=1024, 1.443 ms at L=256; converting the map once into a closure 24.8 ms at 16x16walk micro-programs via hazel-lib.js, Node, laptop025#t-stepsopen here; fixed on a trial in 029 (^ticket(547))
Environment lookups7.2% of a loop, 2.3% of sumbuild, 0.2% of h_refsame profiles035#whereopen
A function Hazel's JS library returns has its environment substituted into its body, so a held list is re-evaluated at every callh_ref 0.234, 1.14, 3.94 ms for held lists of 100, 1,000, 3,000 vs Fumola ~0.291 ms (029); 4,096 numbers held: 5.31 ms and 29.0 MB a call; World rule 90 ms a move at 64x64 (040)h_ref kernel via the JS library, trial/r25-best; hazeljs Boundary benchmark on GitHub, hazeljs 0.0.3029#re-walk (also 040#held)fixed on trials (^ticket(547) -> lib-closures ^ticket(558), PR #2808 open): h_ref(3,000) 4.27 -> 0.055 ms (77x); 5.31 -> 0.025 ms and 93 KB (~215x); World 90 -> 0.75 ms
Applying a handler with Evaluator.evaluate, which closes its answer, copies what the closure closes over63 ms a call, 175x evaluate_open (358 µs)Petri net rule, Hazel test, Node045#handavoided (the app applies handlers open; a library should too)
The picture written out afresh in each of four samples (substitution makes each copy new, so even the encoding cannot share them)probes 0.34-0.35 MB of the 0.42 MB answer after the changesWitch edits after two changes, Firefox on GitHub046#witch-cutsopen (^ticket(718), 047)
Values held as terms: values are terms (open terms, holes, closures) (7)
the costwhat it costsmeasured onreportwhere it stands
Re-stepping the converted argument: of_js builds unevaluated syntax the evaluator steps back into the value it was56% of the 13.8 ms floor of a 16x16 call16x16 World call, 3 s Node CPU profile of the dev build025#callopen (proposal: of_js makes final values)
The evaluator visits values that are already final (values are expressions)a third of a loop's passes take no step (count(1000): 14,009 passes for 9,007 steps); h_ref(3,000) 3,008 passes for one referencekernels, counter build trial/r25-stats029#fix-fast-pathmitigated on trials (^ticket(559), library path only): a tenth of a loop (035: ~8%); h_ref 3.9 -> 0.122 ms (35x; 035 says 32x)
The way back: a compiled view's answer made again as Hazel terms0.27 ms of a 0.34 ms compiled render (79%), against 0.037 ms in (11%); the answer has 861 nodes vs the model's 115Polygons render, Node, trial/694-view-jit045#boundarymitigated: the answer drawn straight from its JS (HazelJitDOM, ^ticket(714), 889271cfbb): vDOM in 0.30 vs 0.71 ms; model to page 0.38 vs 0.79 ms (14.1 ms on the interpreter)
Carrying a changed value back into Hazel wholea list of 1,000 labeled points 5.76 ms (5.76 µs a point; a third of a 16.7 ms frame)diff tests, Node, trial/694-view-jit045#diffmitigated: back as a diff, 0.052 ms (111x); still linear in the change's position until lists are trees (^ticket(710))
The splice's value carried back to Hazel and in again20 of the 21 ms of the Witch picture drawn from JSHazel test, Node, trial/694-view-jit046#witch-45 (also 045#direct)fixed (bcec455abc): 2.6 ms (3.4 with the trip in)
Sending closed, first-order values as Hazel terms (ids on every node, a sharing table)the Witch's picture 142.2 KB, 24.0 ms to encode and decode as terms vs 48.0 KB, 6.09 ms as data (3.0x smaller, 3.9x quicker); all 108 samples 275.9 KB as terms vs 144.7 KB as datalast worker answer on the Witch slide, DataExperiment on trial/694-view-jit (a64335dc37), Firefox on GitHub047#exp1open (design note, ^ticket(718))
Converting a value term to data after the fact110.0 ms for the picture (templated from data/hazel-exp1.json; 276.3 ms for all samples). Caveat: the text says the first, quadratic version took 110 ms and was fixed, yet the filled value is also 110.0, so the post-fix time looks unmeasuredsame experiment047#exp1unclear (the evaluator's form would avoid it)
Values held as terms: probes and samples (6)
the costwhat it costsmeasured onreportwhere it stands
Per-step state merge, run with no live feature in use8.1% inclusiveheld-list walk, dev build profile025#in-hazel-s-library-and-evaluatoropen (proposal)
Per-step probe sampling, run with no probes6.8% inclusiveas above025#in-hazel-s-library-and-evaluatoropen (proposal)
The evaluator's live-feature stages (state merge, reuse check, probe sample, effects) run on every pass, even with no feature in use25.0% of a loop, 43.6% of h_ref(3,000); with the trampolines 37% of a loop and 66% of h_ref; the rule itself 7%count(5000), h_ref(3,000) profiles, Node, embed-520's dev build029#hazel-step (also 035#where)mitigated on a trial by the fast path (^ticket(559)); 035's other ideas untried
Auto-probe rebuilt the whole top level's skeleton every frame (memo keyed on a segment every edit replaces)244 ms, 13% of the profilesame profile, #2635036#fix-rootfixed on #2635 (394552d5d0; #2635/#2469 only); with the next fix, 31-46% off at the largest sizes
A probe's environment written out whole: the Drawing module in the sample of a probe whose value is a few bytesresult 5.4 MB for a 10 KB request (~536x); probe samples' environments 4.14 MB (77%); Drawing alone 3.8-3.9 MB (~70%), kept because an explicit probe keeps every name its expression uses and Sample.Env.elide substitutes each value's environment in, eliding only bare functionsWitch neck and arms edits, Firefox on GitHub, trial/694-view-jit046#witch-answer (also 046#witch-cuts)fixed on the trial (20a3067c18, function-holding values left out) with the trace cleared: result 0.42 MB (13x smaller), edit 1.9-2.4 s (2.2-3.2x sooner)
Samples' environment copies in retained memory (a code comment, not measured in the series)once about 80% of retained memorynote in CachedStatics.compute_targets, read on dev047#whyunknown
Whole-program work on every edit: re-analysis per edit (statics, parsing) (28)
the costwhat it costsmeasured onreportwhere it stands
#2597 re-runs statics on the whole program after every livelit commit3.5 s of a 5.8 s profiled release (CachedStatics.init); release 3.76 s on #2597 against ~0.35 s on #2635Kids' Choice release, #2597 vs #2635, headless Firefox, median of 12001#pipelineopen on #2597; avoided on #2635 by #2469's per-item statics (not on dev)
The commit re-makes the syntax (livelit placeholder shapes, per-item parsing)26 ms profiled per releaseKids' Choice release, #2635, Firefox profile001#nowopen
The first release after a load re-parsed the whole program (the wrong parse cache was filled)commit 245 ms instead of ~60Kids' Choice first release (8,612-piece face definition), #2635001#pipelinefixed (9d9d40dae2): 55-63 ms
Every let-bound function takes statics' recursive path; passes multiply with nesting (up to 4^depth)001: nested lets 400 s; 017: 5.3 s of statics at eight levels; b2t2 example-tables 73 msnested-let programs and b2t2/example-tables.hz, dev017#pr2603 (also 001#issues)fix #2603 open to dev: 400 s -> 0.6 s (001); 5.3 s -> 13 ms, 73 -> 49 ms; real programs 20-30% faster (017)
A module binding's definition analyzed a second time1.79 s of 4.2 s of statics (about 43%); CLI statics 6.7 s; on dev, about 0.13 s of 6 s on an 800-function moduleShirt and Pants slide, #2635, profile and Hazel CLI; made-up 800-function module on dev024#cost (also 001#issues, 017#pr2651)fixed on #2635 (7b73b74976); PR #2651 to dev open: CLI 6.7 -> 4.3 s on #2635, within noise on dev
A livelit definition analyzed twice (synthesis, then analysis)Shirt and Pants statics 4.3 sShirt and Pants slide, livelits001#issuesfixed on #2635 (76ecb91394): 2.8 s
Statics re-ran 3x per edit (probe pins compared to the wrong keys)head-colour slider 20.6 slivelits slide, 2026-10-01001#issuesfixed (d42ae8193d): ~2 s
Statics analyzes some expressions several times per multiplier (recursive lets, shadowed builtins, unannotated labelled params)up to 12x per expression on B2T2 programs, 3^d for nested recursion (001); a recursive let 3x, nested recursive lets 27x (021)B2T2 programs and the corpus, counted with --count-passes (dev + #2603 + #2651)001#issues (also 021#pr-2689)open; #2689 pins the multipliers and budgets the corpus (at most 5 analyses of one expression, 2.5 on average)
#2597 runs whole-program statics from scratch on every update during load15% of the main threadScenes load, #2597007#whyopen on #2597
#2597 runs whole-program statics on every slider change (no modular editing)5.4 s of a 13.3 s profiled change; median 8.6 s against 1.2 s on #2635 (statics 38 ms there)Full Body slide, arm-length drag, #2597 vs #2635, headless Firefox008#aopen on #2597; per-item statics on #2635
Statics rebuilt the spine root of every item below the edit149 of 179 roots re-added per release; statics 42 ms (Witch), 23 ms (Full Body)Playground slider releases, Node, #2635013#changefixed on #2635 (9fb2bdf067): 42 -> 23 ms, 23 -> 20 ms
Per-member module analysis lost on #2635 after a merge, so a module literal is analyzed wholeedits in mega-mod-1k wrapped in a module ~100 ms vs 7 ms (Andrew Blinn's commit message)mega-mod-1k on #2687; the loss on #2635018#whyfixed on #2635 by #2699 (2026-10-19)
Opening slides: statics23 s of 213 s (about 11%)58 slides, headless Chrome on GitHub, #2635020#timingopen
Opening slides on #2597 (no per-item statics): statics dominatesstatics 143 s of 362 s of script (about 40%); figure slides 35-71 s (6-8 s on #2635); ConstructorMap.re 45 s (4.5 s on #2635)55 slides, headless Chrome on GitHub, #2597020#timingopen on #2597
Nested module bindings multiply statics passes (3^depth on dev, 2^depth with #2651, counted from code)depth-9 function chain 31.04 and 29.59 s with #2651; 3.8-3.9x per level; depth-12 fix chain 197.2 stest chains of nested modules, Hazel CLI, builds of #2651 and draft #2717 (dev-based)024#nextfix in draft #2717 (a module binding as a non-recursive let): 1.43/1.45 s, flat at depths 4-12
Compiling a program for the library (parse, then statics)the game's rules 797 ms; first compile in the browser 340-520 ms; Hazel 514 ms where Fumola sets up in 4 ms (027)Dress Up's room rules, first call in a fresh Node process; browser on GitHub025#prs (also 027#next, 030#built)mitigated on a trial with all 14 PRs: 402 ms (none merged)
The first event after a reset compiles the rule program0.5-0.7 s (502, 692, 519 ms); Fumola's slowest pull 12-21 mstrap-room lever pulls, Dress Up, Chrome headless on GitHub032#tableopen (next: compile ahead)
After an edit, readiness grows with the program (whole-program analysis)357.5/435.4/744 ms at 1x/2x/4x Common's size (~4 ms a line); analysis 260/302/428 ms; Fumola flat ~125 msCommon copied 1x-4x, Dress Up, GitHub runner032#scaleopen
Analysis of a module grows superlinearly with its members100 short members ~110 ms, 400 members ~2.3 s (4x the members, ~21x the time)hazeljs 0.0.1 (dev of 2026-10-19 + library), Node 22, laptop, measured once034#release-found (also 039#package)unknown
First load of the library and its first analysisabout a second ('analyzed and run in 1148 ms')Dress Up game log, draft library034#muduopen
Edit, undo and redo each grow linearly with the programat 6,400 definitions: edit 106 ms, undo 292, redo 184 (163/422/340 before two fixes), each followed by ~78 ms of statics; log-log slope 1.10-1.16Test_UndoScaling, a chain of n lets (400-6,400), Node, release build, #2635036#scaling (also 038#time)partly mitigated by two fixes on #2635 (31-46% off at the largest sizes); still linear
MakeTerm rebuilds the whole top-level term every step523 ms, 38% of the profile (527 ms, 29% before the fixes)CPU profile, 12 steps at 3,200 definitions, Node, #2635036#where (also 038#time)open (needs the top level as a balanced tree)
DefStatics walks the whole chain of definitions every step283 ms, 20% (289 ms, 16% before)same profile, #2635036#where (also 038#time)open
Completion suggestions computed after every typed digit (a pass over the program)178 ms, 10% of the profilesame profile, #2635036#fix-digitsfixed on #2635 (bfa36a6ede); dev has the same code
Initial build of the editor for a large program173 ms at 400 definitions up to 2,637 ms at 6,400Test_UndoScaling, Node, #2635036#scalingunknown
Building and rebuilding a small programfirst build 338-366 ms; rebuild after an edit 138-154 ms whether a module changed or not; ~180 ms in the browsersame Petri example, Node, three runs043#costopen (the game hides it behind a 600 ms typing pause)
The page's work after a livelit event (the program's text changed and analysed again, the editor drawn), now most of an eventa click's change 77 ms compiled vs 124 on Polygons; 319 vs 368 ms on Full Body; 304 vs 354 on the Witch; a drag step 36 vs 62 ms, while the livelit's own update is ~0.05 mssix polygon slides, Firefox on GitHub, release build, trial/694-view-jit045#browseropen
The main thread's own work on an edit before the request goes (update, a page view, statics and the request's pieces)0.31-0.41 s to the page's first change (19-24 frames); 0.18-0.27 s before the request in the timeline runWitch slide small edits, Firefox on GitHub, release build, trial/694-view-jit046#witch-edit (also 046#witch-edit-parts)open, not broken down
Whole-program work on every edit: the page's view and redraw (25)
the costwhat it costsmeasured onreportwhere it stands
The page rebuilds its whole view in JS on every redraw, and a release redrew six timesabout 310 ms (profiled) of a 0.43 s releaseKids' Choice slider release, #2635, headless Firefox001#pipelinemitigated: b481a876e1 (6 -> 4 redraws), main-thread work 1,141-1,427 -> 935-1,051 ms; sub-view reuse 51df91d5d7, 157 -> 138.5 ms
#2597's view rebuild without #2469's caches and gates1.6 s profiled (~0.37 s on #2635): view samples rerun 0.57 s, uncached code view 0.41 s, incremental-eval overlay drawn though off 0.39 s, whole-program re-parse 0.2 sKids' Choice release, #2597, Firefox profile001#pipelineopen on #2597; avoided on #2635 via #2469
Livelit views evaluated in each redraw44 ms profiled per release (face evaluation 21, its Html to the page 8, probe sample views 7, rest 8)Kids' Choice release, #2635001#nowopen
The code editor re-checked every tile's sort on every commitcheck 16 ms, code editor 26 ms profiled (3-5 ms on the clock); 25,852 tiles per commit on mega-4kKids' Choice release, #2635; mega programs in tests001#nowfixed (31502d1e3d): check 16 -> 0.3 ms, editor 26 -> 8 ms; mega-4k 25,852 -> 270 tiles
Measuring the page after each redraw forced synchronous layouts and document-wide style recalcsafter-display effect 24 ms profiled; main-thread work 246 ms per releaseKids' Choice release, #2635001#nowfixed (3c270617e2): 24 -> 3.6 ms; main thread 246 -> 207 ms
The problems panel walked the whole program for incomplete tiles on every redrawpanel 13 ms, walk 6 ms profiledKids' Choice release, #2635001#nowfixed (0560e5a124): 13 -> 3 ms, walk 6 -> 0.2 ms
A view re-evaluated every call though only one input changedface's first evaluation after a release 43 ms (median of 12)Kids' Choice, #2635001#pipelinefixed by CallMemo (c64c558e86): 43 -> 12.5 ms; loads ~7.0 -> ~7.4 s
Every redraw evaluated every livelit's view, changed or notKids' Choice 0.8 sKids' Choice, #2635001#issuesfixed (4239ecf04f): 0.53 s
Cursor info rebuilt the program's source and compared it structurally on every redraw~40 ms profiled per releaseKids' Choice, #2635001#issuesfixed (4d591fc2bc)
^picture's view prints every point to SVG text in Hazel code; the worker computes points one at a time~1.7 s per change on the main thread and ~1.5 s in the worker (profiled)Hands slide, alien fingers, #2635, headless Firefox002#handsmitigated in slide code: seven alien fingers 4.7 -> 2.5 s
The page drawing a woods picture it had not drawn before5.7-6.6 s (0.6-1.1 s for one drawn before)woods, #2635, before 004's view fixes004#timelinemitigated by 004's fixes (figure move median 1.41 s)
^picture's view box walked every point; points strings built point by pointview_box 134,320 steps (56%), coords 92,703 (39%) of 238,781 view stepswoods picture (570 shapes), Node step counts004#updatefixed: 238,781 -> 99,621 steps, redraw median 2.20 -> 1.52 s; cheaper strings -> 74,055 steps, ~6% less time
The app's own update machinery (frame callbacks, recomputing its views)25% of the page's main threadwoods, #2635, Gecko profile005#updateopen
Html to virtual DOM, the vDOM diff and patch, browser layout1.1%, 0.9%, 1.4% of the woods main threadwoods, #2635005#updateleft alone (at most ~2% to gain)
#2597 rebuilds the code editor's view of the whole program on every update77% of the main thread during loadScenes load, #2597, Gecko profile007#whyopen on #2597
#2597 rebuilds the whole code view and prints the whole program to text on every changecode view 2.3 s, program to text 1.5 s (profiled)Full Body, #2597008#aopen on #2597
Cells' livelit views drawn without the view memoabout 0.46 s per change profiled; updated 10-14: ~340 ms of profile, perhaps 0.1-0.2 s on the clockFull Body, UX mode, #2635008#bopen
Livelit views evaluated on the page inside the editor's updateabout 450 ms of a Full Body change's ~1,010 ms of page JS (the update ~860 ms)Full Body change, headless Firefox 157, #2635015#changeopen; views-in-the-worker prototype parked (016)
Opening slides: the page's view55 s of 213 s of script (about 26%) over 58 slides; 30-40% on most slides58 slides opened fresh, headless Chrome on GitHub, #2635020#timingopen
Opening slides: layout13 s of 213 s (about 6%)58 slides, headless Chrome on GitHub, #2635020#timingopen
The context inspector prints every prelude type whole as tiles6,802 tokens drawn for a 4-line program; froze the browser on Scenescontext inspector, #2635020#gammafixed with a size budget (^ticket(396))
Layout's walk over the program (Measured.of_segment)78 ms, 6% of the profilesame profile, #2635036#whereopen
With the sidebar shown, every edit rebuilds the outline44 ms after an edit of 51 ms at 3,200 definitions; 84 after 113 at 6,400same probe asking for the outline each step, dev-profile build, #2635038#sidebaropen
HazelDOM drawing a view's Hazel Html into virtual DOM0.44 ms, more than the trip back (0.27 ms); 0.71 ms through Hazel vs 0.30 ms straight from JSPolygons render, Node045#directmitigated on the trial (HazelJitDOM)
The whole slide's page view, drawn five times an edit24-506 ms (median 117) each draw; 0.5-0.9 s an edit; the picture's own view 3.0 ms of itWitch small edits, Firefox on GitHub, release build046#witch-edit-parts (also 047#goal)open
Whole-program work on every edit: incremental reuse checks (12)
the costwhat it costsmeasured onreportwhere it stands
Reuse check compares cached expressions by structure, walking down to the edit once per enclosing let (quadratic along the lets)reuse_check ~283 ms of a ~410 ms worker release (profiled); on dev, 2,743 ms to re-evaluate after one edit in a 400-definition program (4,353 ms with hashing alone)Kids' Choice slider release, #2635, headless Firefox; 400-definition program on dev, Node, median of 7001#pipeline (also 017#pr2673)fixed on #2635 by a Merkle hash plus a pair memo (5237161017, 97c910f69c): reuse_check 283 -> 26 ms, worker 410 -> 145 ms; dev PR #2673 open: 2,743 -> 410 ms
Reusing a cached result walked the whole reused code to copy cache entries16 ms of the worker's 47 ms evaluation (profiled)Kids' Choice release, #2635001#nowfixed (9129cd2774): evaluation 47 -> 25 ms; worker per release 69 -> 45 ms
A projector update copies the whole program, so identity-keyed caches (per-item parsing) see a new programKids' Choice release 1.5-1.7 s; dev 3.12 ms per update on a 2,000-let programKids' Choice on the livelits branch; 2,000-let program on dev017#pr2671 (also 001#issues)fixed on #2635 (cefa5c2c5c); PR #2671 to dev open: 1.5-1.7 -> 0.7-0.9 s; dev 3.12 -> 1.92 ms
A recursive let's own name leaked into its free variables, so nothing from the Drawing library on was reusedevery woods change re-ran all 610,670 steps; ~3 s of a figure moveScenes slide, woods, #2635004#reusefixed on #2635 (4b964e6660); dev PR #2675 open (dev has the bug): figure size 8.4-10.7 -> 6.1-7.3 s
The view's call memo cost more than it saved (8 entries per function, every call a miss, each paying for its key)a third of the view; woods figure size 6.1-7.3 s with the memo against 2.4-2.9 s withoutScenes slide, woods, #2635, four runs004#memofixed: give up after 24 misses per hit (126f595ce9): 2.6-3.5 s
An open cell re-elaborated with fresh ids; the reuse check traced lexemes once per enclosing let (quadratic)about 2 s per change (122 slow checks of ~6,400-node subterms); GUI-only view 3.5 s against 1.2 s wholeFull Body in UX mode, #2635008#reusefixed (cbdab791f5): slow path 1-4 ms; 3.5 -> 1.26 s
Incremental evaluation saves nothing on a slider editFull Body 499 vs 464 ms from scratch, Witch 754 vs 701, Scenes 1,416 vs 1,453 (corrected 2026-10-13 to one protocol; conclusion unchanged)slider edits, Node, each slide in its own process, #2635009#reuseopen
Reuse works only per top-level binding, so nothing inside the picture is reusedincremental run skips 8-14% of a from-scratch run's steps; 75-84% of its steps are in calls whose inputs did not change (steps, checks free)Full Body, Witch, Scenes, one slider edit each; Node oracle, #2635010#workopen
Every slider edit re-evaluates the whole figure, even when the picture does not change85-95% of a from-scratch run (Full Body, Witch); 85-92% for the 22 edits that change no shape; 85.2-89.0% (012); a position-keyed update would cost 0.0-1.7% (steps)all 63 sliders on Full Body, Witch, Scenes; Node oracle, #2635011#sweep (also 012#trace)open
The page checks the whole program for reuse on every dragged value's previewabout 40% of the page's time over a Full Body drag (profiled)Full Body slider drag, Gecko profiles, #2635015#bridgeopen; partly mitigated by coalescing previews (016)
Per-step reuse check, run where no reuse is possible8.0% inclusiveas above025#in-hazel-s-library-and-evaluatoropen (proposal)
Each run's new picture shares nothing with the last, so finding unchanged parts costs a whole walkthe merge 0.23 ms, as much as the whole view (0.24 ms), where a kept view would redo the neck's 17 shapes in 0.043 ms (5x less)prototype edit-share.mjs on hazel-jit's compiled Witch view, Node046#witch-shareopen (proposal: share during the trip in)
Whole-program work on every edit: parsing on load (5)
the costwhat it costsmeasured onreportwhere it stands
Loading text the fast parser rejects: the fallback types it one character at a time, re-molding each time (quadratic)182 s over 128 inputs; 8 KB of prose 64 s; 001 (with #2614): corpus 1,242 s, Kids' Choice 227 severy program and tutorial section, dev017#pr2610 (also 001#issues)fix #2610 open: 182 -> 63 s, 64 -> 1.3 s; with #2614, 1,242 -> 433 s and 227 -> 93 s
The recovering parser inserts and re-grouts per characterparsing the 72 programs ~220 s; parse-heavy test groups 267 s72 programs and CI parse test groups, dev017#pr2614fix #2614 open: 220 -> 87 s, 267 -> 142 s
Opening slides: building terms45 s of 213 s (about 21%)58 slides, headless Chrome on GitHub, #2635020#timingopen
Opening slides: parsing41 s of 213 s (about 19%); Dynamic Row or Column 12.5 s, parsing 45% of it58 slides, headless Chrome on GitHub, #2635020#timingopen
The recovering parser is quadratic on an unclosed bracket21-81 ms for well-formed modules, up to 1.8 s with an unclosed bracketDress Up Scripting panel modules, draft library (#2711/#2719)034#mudupartly mitigated (#2719's FastParse keeps an unfinished last member on the fast path)
Whole-program work on every edit: undo and history (5)
the costwhat it costsmeasured onreportwhere it stands
The undo history kept a whole editor state per edit, uncapped by default~92 MB per edit (014; 89.0 MB in 038); 1,048 MB after 12 edits; capped at 2, ~290 MB (020) / 284 MB (038); of 390 MB kept over 4 edits: types and statics 119 MB, ValueHash 98, terms 64, decoded replies 46, layout 41; #2635 52 MB after 12 (036: ~8 MB an edit). Corrected 2026-10-14: first said 'not the caches' (the test build's cap never ran)Full Body slider edits, headless Chromium, #2597 (and #2635)014#update (also 014#what, 020#undo, 036#question, 038#space)fixed on #2597 by porting Andrew Blinn's compaction (d41c7a0298): 159 MB (020: near +160); with newest entry kept whole (f8ae6f2b9c): 208 MB; open on dev (whole copies, cap off by default, never measured)
Compaction's price: restoring a compacted undo entry rebuilds its derived data#2597: every redo 6.0-6.5 s against 2.7-3.1 s as built (014); undo 5.8 s, redo 6.1 s against a 6.9 s edit (038). #2635: redo 3.6-4.2 s (median 3.9), undos 3.5-5.1 s (014) or 3.6 s, 1.2-3.9 (038), against a 1.2 s editFull Body edit/undo/redo in a browser, five runs per build014#update (also 038#price)mitigated: newest entry kept whole (f8ae6f2b9c on #2597, 032fe3aca6 on #2635): latest undo/redo within 0.3 s; older undos still rebuild
The outline is rebuilt from scratch on every undo (its memo misses the restored program)036: 211 ms, 15% of the profile, '~26 ms of each undo and redo' at 3,200 definitions. Corrected in 038 (2026-11-03 07:52): ~39 ms per undo at 3,200 definitions, 32-40% of an undo from 1,600 up (116 ms, 40%, at 6,400), nearly all of what an undo costs beyond a redoTest_UndoScaling, release step times and dev-profile CPU profiles, #2635 (dev has no outline)038#outline (also 036#twice, 036#where)open
The newest undo entry, kept whole for a fast undo, grows with the program0.55 MB at 400 definitions, 1.9 MB at 1,600, 6.9 MB at 6,400 (~1.1 KB a definition) vs ~0.01 MB compactedchain of n definitions, Node on GitHub, trial/665-space off #2635038#persizeopen (by design)
An undo or redo rebuilt the program's syntax twice (RealizeView counted as an edit)undo 141 ms at 3,200 definitions, 263 at 6,400; redo 96 ms; a redo spent ~1.8x an edit's time in CachedSyntax.mksame probe, dev-profile build, Node038#twicefixed (ed4d484671; on #2635 as 9df1b2601e per agendas 037/042, 038 says trial only): undo 141 -> 84 ms (40%; agendas say 85), 263 -> 184 (30%); redo 96 -> 41 ms (57%)
Values moved as terms across boundaries: serialization (Marshal, sharing) (15)
the costwhat it costsmeasured onreportwhere it stands
Every request sent the worker the whole elaborated program and its statics table478 KB of Marshal per request; encoding ~52 ms on the main thread, decoding ~22 ms in the worker (profiled)Kids' Choice slider release, #2635, headless Firefox001#pipelinefixed on #2635/#2597 by ShareCodec diff requests (993e3d5f91): 478 -> 18.5 KB; release to face 359 -> 228.5/272.5 ms
Each worker result was sent whole; marshaling it took as long as evaluating393 KB result; marshaling 44 ms against evaluating 48 ms; page decoding 14 ms (profiled)Kids' Choice release, #2635, Firefox profile001#nowfixed (90994d4443): 393 -> 15-16 KB, encode 44 -> 5 ms, decode 14 -> ~7 ms (005#fixes gives 14 -> 1 ms for the same commit)
Elaborations keep every source node's whitespace and comments, which nothing readsrequests 12-49% larger (five programs; probes.hz 48.0 vs 24.5 KB); 031: about a third of each program sent before #2608, and ~13.5% of the marshaled size still survives with it (through Typ.normalize)worker requests, marshaled bytes, dev; reviewer's probe over 72 docs programs017#prs (also 001#issues, 031#pr-2608)PR #2608 to dev open, changes requested 2026-10-21
The builtin Html type written out in every ascription; Macro uses closed over all builtinsa slide's request 609 KBlivelits slide, #2597001#issuesfixed (4eeebeaff3, 6b42a0e09a): 224 KB
The worker encoding its result for the pageabout a third of the worker's share of a woods change; result ~1 MBScenes slide, woods, #2635, Gecko profile004#costunknown
Hashing and encoding the request on the main threadFull Body hashing 3.88-4.21 ms, encoding 1.96-11.22 ms per release (encoding moved with the heap, not the work)slider releases, Full Body and Witch, Node, #2635013#questionhashing mitigated (9fb2bdf067: 1.04-4.02 ms); encoding unchanged
ValueHash's memo: a hash for every object, in a WeakMap of about two million entries98 MB (25%) of what four edits kept on #2597; 9.8 of 37.5 MB on #2635; stopped heap snapshots finishingFull Body, headless Chromium, #2597 and #2635014#snapshotsopen
ShareCodec's tables of values shared with the worker build up between resets#2635 keeps 9 MB after one edit, 94 MB after ten, then 46 MB; cap 200,000 entriesFull Body, 30 edits, #2635014#updatebounded (reset at the cap)
After merging #2469 into #2635, a livelit release posted its changed definition whole, unshared~492 KB per release against ~16 KB shared; releases 20-30% slower (median 280 ms against 251.5 before)Kids' Choice eye-size slider, #2635 deploys, GitHub's machines020#merge469fixed (2b080af683): 203.5 ms median, ~11 KB
Decoded worker results lose object identity, so identity-keyed memos miss0 of 192 blocks (Kids' Choice) and 60 of 137 (Full Body) came back as the objects decoded before; costs little at this size (037)^ticket(666)'s probe, #2635, Node038#precompactopen
(agenda only) A request to the worker without sharingFull Body after one retyped number 1.95 MB in 260 ms whole vs 26.8 KB in 4 ms shared; Kids' Choice 494 vs 52 KB^ticket(666)'s probe, #2635, Node on GitHub037#2-how-much-sharing-is-lost-passing-data-to-and-fmitigated (requests are shared on #2635)
(agenda only) The first send with sharing costs doubleFull Body 624 ms shared vs 308 ms wholesame probe, #2635037#2-how-much-sharing-is-lost-passing-data-to-and-fopen
The worker's sharing pass hashes every value of its answer and finds almost nothing to share1.4-1.6 s a result (2.0-3.4 s on an arms edit with its stream); 0 references found on the arms edits, 242 on the neck; after two changes 154-255 ms to save 0.46 -> 0.42 MB, more than encoding and decodingWitch neck and arms edits, Firefox on GitHub, release build046#witch-trip (also 046#witch-cuts)fixed: dropped from the worker's answers (4747a4120d): edit 1.3-1.7 s, the trip 79-102 ms (5-8%); requests keep sharing
Encoding the worker's answer with Marshal1.1-1.2 s for the 5.4 MB result (~0.22 s a MB)Witch neck edits, Firefox on GitHub046#witch-tripmitigated by a smaller answer: 48-57 ms (0.42 MB), 59-80 ms unshared (0.59 MB)
Decoding the worker's answer on the main thread, one long task (Marshal back, references resolved, every new value hashed)1.4-2.0 s for the 5.4 MB result (trip run); 1.9-3.1 s (timeline run), at least 116 frames frozen; 1.3-1.5 s for a 4.4 MB stream; ~0.32 s a MBWitch small edits, Firefox on GitHub, release build046#witch-edit-parts (also 046#witch-trip)mitigated: 113-159 ms after two changes; 16-24 ms unshared
Values moved as terms across boundaries: the JS boundary (js_of_ocaml) (15)
the costwhat it costsmeasured onreportwhere it stands
The evaluator re-applied itself to the run's five constants at every call (a closure per node, js_of_ocaml's generic call path)30% of face view evaluation (~60 ms)Kids' Choice face view, #2635001#issuesfixed (857c293962): ~60 -> ~42.5 ms
The evaluator under js_of_ocaml rather than wasm_of_ocamlabout 4x slower on fixed-precision workwasm spike #2490001#nextopen (spike not meant to merge)
Opening slides: js_of_ocaml's runtime with no Hazel caller14 s of 213 s (about 7%)58 slides, headless Chrome on GitHub, #2635020#timingopen
The call boundary's floor: every call converts the whole JS argument to Hazel syntax, re-evaluates it, and checks its typeidentity rule 8.54 ms at 16x16, 19.3 ms at 24x24; 13.8 ms vs 0.44 ms with no cells (~3 µs per node); the same rule in JS 0.003 msWorld rule via hazel-lib.js (dev-based), Node, laptop025#call (also 030#speed, 034#mudu)open (^ticket(539)); workaround: pass only the neighbours, 0.889 ms; see 040 for the direct-conversion trial
js_of_ocaml's generic calls in the evaluator's stepscaml_call_gen 7.9% + caml_call1 3.7% of self time136-step held-list walk, 13.5 ms a call, dev build, Node (025/data/profiles.json)025#callopen
The least a call across the boundary costs, with a tiny argumentabout 1 ms at every size (Hazel 1.27, Fumola 1.35 ms at 64x64); 0.889 ms vs 0.003 ms in JS (025)World rule, neighbours only, Node, trial/r25-best027#numbersopen
js_of_ocaml turns each id's 16 bytes into a JS string by handabout three quarters of minting an id (of the 46% above)sumbuild(1000) profile, Node, dev build029#idsopen on dev
Converting a JS argument into Hazel at every call (no handles)64x64 map 80.3 ms; 48.9 ms a call for a rule that ignores the map (029); 4,096 cells 66.5 ms converted each call (040)World rule and skip kernel via the JS library, trial builds (029); handles trial build (040)029#report-27 (also 029#fix-world-passed, 040#handles)mitigated on the handles trial (^ticket(551), PR #2809 open): 0.025 ms (029), 0.024 ms (040) a call at any size
A call into a Hazel rule in the game3.5 ms median vs Fumola 1.6 ms; a lever pull 13.7 ms with Hazel, 10.7 with Fumola, 9.7 with JS60 lever pulls, Dress Up, Chrome headless on GitHub032#events (also 039#speed)open
A JS argument becomes Hazel syntax with a fresh id per node, is evaluated back, and is type-checked: time4,096 cells typed 139.2 ms, untyped 107.5 ms; 64 cells typed 1.49 mshazeljs Boundary benchmark, Node 22 on GitHub, hazeljs 0.0.3 (#2719, dev-based)040#timemitigated on the lib-floor trial (^ticket(539), PR #2807 open): 51.3 ms (-63%), 18.3 ms (-83%), 0.62 ms
The same boundary conversion: memory1,024 cells typed 80.4 MB a call, untyped 71.2 MBsame benchmark, one call after a forced GC040#spacemitigated on lib-floor (PR #2807): 20.2 MB, 11.0 MB
A Hazel event-handler call through hazeljs vs the same handler in JSabout 3.3 ms a call (3.2-3.4; p90 ~4 ms) vs 0.7 µs in JS; 2,000 steps ~7 s; boundary/evaluation split not measured (045: the interpreter alone 358 µs on this rule)Petri net rule, hazeljs 0.0.4 (#2719), Node v22, laptop, 2,000 calls x 3043#costopen (hazel-jit being tried)
Whole numbers carried back through Printf and big-integer parsing; tuple labels found by raising and catching an exception per labelabout 2 µs a number; a list of 1,000 labeled points 8.2 ms backNode, trial/694-view-jit045#difffixed: 2.2-5.6 ms
OCaml's Printf under js_of_ocaml for number formattingWitch view 1.01 ms via Printf.sprintf vs 0.19 ms via toFixed (5.3x)the Witch view ported to OCaml, js_of_ocaml 5.9.1, Node (a benchmark port, not Hazel's own code)046#witchn/a (benchmark finding)
js_of_ocaml's to_js, carrying the picture into JS0.88 ms of the 3.4 ms frame vs 0.08 ms building the same objects in plain JS (11x; different processes, rough)Witch picture, Hazel test vs Node046#witch-shareopen
Values moved as terms across boundaries: the worker trip (10)
the costwhat it costsmeasured onreportwhere it stands
Building the request's statics projection walked both statics maps whole (first blamed on hashing)001: 17 ms profiled, first given as 15 ms of hashing; corrected 2026-10-14: hashing 1-4 ms. 013: 1.9-11.9 ms per release (Full Body 11.64-12.22 ms)slider releases on 8 Livelit Playground slides, #2635, Node test build013#numbers (also 001#now)fixed on #2635 (043508921b on 8fbc86c644): 0.19-0.92 ms; ported to #2469 locally (8.9 -> 0.33 ms); dev and #2597 cannot take it without per-item statics
Collecting streamed results re-indexed the whole elaborated program after every commit44 ms profiled per releaseKids' Choice release, #2635001#issuesfixed (42902c2d2a): 44 -> 6 ms
The worker's answer carries its whole incremental cache, and the page sends it straight backanswers 86-98% larger than needed; one livelits answer 332 KBworker answers; a livelits slide on #2635017#pr2606 (also 001#issues, 005#fixes)fixed on #2635 (e0a5b16555): 332 KB -> 0.9 KB; dev PR #2606 open
The page rebuilt an index of the whole elaboration for each new evaluation204 ms of a 949 ms page update (profiled)Full Body, whole program, #2635008#indexfixed (8717564a5f): 115 ms profiled
Each item's spine root carries the whole program below it, so the request grows with how deep the edit is3.6 ms at item 26 of 167, 20.8 ms at item 134; 808 vs 5,768 nodes copied (~46 per item above the edit)Full Body and Witch slider releases, Node, #2635013#leftopen
Moving the livelit views into the worker makes the final picture wait for the tripfinal picture +0.28 s later in UX mode (8 of 10 rounds)Full Body long drags, #2635 + prototype 4c9331d13c016#releaseopen; prototype parked
The eval worker's own bookkeepingWorkerMetrics.re 4.3 s + WorkerServer.re 6.2 s, about 10 s over 58 slides58 slides, headless Chrome on GitHub, #2635020#timingopen
(agenda only) The worker reassembled the program from its pieces on every request47 ms on Full Body even when nothing changed (0.1 ms sent whole), 8 ms on Kids' Choicesame probe, #2635037#2-how-much-sharing-is-lost-passing-data-to-and-ffixed (39ad6c8cdc, worker memo of composed programs): 36.2 -> 0.8 ms, 9.3 -> 0.1 ms
(agenda only) A one-literal edit re-sends about 10% of a chain of letsabout 10% of the program; every let around the edit hashes anew^ticket(666), a chain of lets, #2635042#1-undo-and-redo-in-o-log-n-in-space-and-in-timeopen (balanced tree proposed)
The observation trace shipped to the page, where nothing reads it1.40 MB of the 5.4 MB result (1.27 MB the environments of 5 span-close events)Witch edits, Firefox on GitHub046#witch-answerfixed on the trial (cleared in WorkerServer.slim_state, 20a3067c18)
Values moved as terms across boundaries: scheduling (worker slices, message cadence) (4)
the costwhat it costsmeasured onreportwhere it stands
The worker yielded with setTimeout after every 5,000-step slice; chained timeouts clamp to ~4 ms5.8-6.2 s of a ~10 s woods change idle between 1,292 slices (3.9-4.4 s evaluating)Scenes slide, woods, #2635, headless Firefox004#timelinefixed (25e515536d): worker 10.0-10.7 -> 2.1-2.6 s; Scenes load 23.5-26.3 -> 17.2-17.4 s
Stream messages swamped the page (a full update per message)page busy 45.5 s after opening a 1,000-item program; 46.7 s for 2,000generated programs, #2469 (Andrew Blinn's measurements)005#fixesfixed on #2469/#2635 (throttle c07bdacead): 45.5 -> 5.4 s; a05f8e5791: 46.7 -> 10.2 s
#2597 runs a full page update for every stream message, and its worker posts after every slice2,520 messages at ~140 ms each; Scenes first picture 287.5 s (12.5 s on #2635), Witch 173.1 s; worker idle 98.7%Scenes and Witch slides, cold load, #2597, headless Firefox007#whyfixed on a copy of #2597 by #2469's throttle (c07bdacead): Scenes 16.4-17.6 s, 86 messages
Every preview in a drag makes the page recalculatefreeze 4.02 s per 1.5 s drag (~91 ms per input)Full Body long drags, side-by-side builds, headless Firefox 157, #2635016#tablemitigated on a local branch (3eb4489124, keep only the newest preview): 2.19 s, lower in 10 of 10 rounds; each repaint still ~90 ms
An interpreter that pays for the editor at every step: interpretation itself (12)
the costwhat it costsmeasured onreportwhere it stands
Evaluating the face's own view, the largest single cost left~70 ms per releaseKids' Choice release, #2635001#nextopen
The evaluator's own work in the view (variable lookups, pattern matching, fresh ids)about 500 ms of the woods viewwoods figure move, #2635004#updateopen
Evaluating a livelit's view on the pageabout 50% of the page's main thread, about 69% counting the GC it causeswoods, two figure-size changes, #2635, Gecko profile005#updatemitigated by 004's update (median 2.20 -> 1.41 s)
Opening slides: evaluation10 s of 213 s (about 5%)58 slides, headless Chrome on GitHub, #2635020#timingopen
Each evaluation step costs about 3 µs~3 µs a step; a plain walk 25-80 µs per cell; countdown 128 steps 3.836 ms (3.162 ms after the PRs, -18%)micro-programs via hazel-lib.js, Node, laptop025#callopen; no PR aims at it
Hazel walks the same list more slowly than Fumola64x64 passed 346 vs 145 ms (2.4x), held 254 vs 26.3 ms (9.7x) (027); 341 vs 148 ms (2.3x), 261 ms of it walking (~64 µs a cell), held 256 vs 28.7 ms (8.9x) (029)World rule, 64x64, Node/GitHub runners, trial builds027#numbers (also 029#report-27)mitigated on trials (030: 241 -> 0.97 ms a move with stacked fixes); not in the game's build
Each Hazel evaluator pass costs far more than a Fumola step~2.6 µs per Hazel pass vs ~0.13 µs per Fumola step, 'some 20 times as much' (029's body); the series index, 035 and 047 say 'about 15 times'. Net Fumola 10x faster on the loop, 6.5x on callscount(n) and fib(n) through Hazel's JS library, Node laptop, trial/r25-best (dev + perf PRs)029#steps (also 035, 047#experiments)open
Building the World map: three list walks at the per-pass cost1,539 ms at 64x64 (order check 662, count 286, build 927); 60-70 µs a cell; set-up 2,136 ms vs Fumola's 326 (~6.5x)Common.squares, trial/r25-553, GitHub runners029#fix-game-map (also 030#setup)open (^ticket(554)); merging the count into the order check saved 15%
A livelit view on Hazel's interpreter (Polygons)a render 13.7 ms on the interpreter vs 0.34 ms compiled, warm, with the trip in and out (40x); the compiled call alone 0.043 ms (315x); Petri rule 7.19 vs 0.011 ms (630x); recursive sum of 1,000 47.9 vs 0.042 ms (1,152x). Update 2026-11-06 19:00: first said ~16x (cold renders), then 34x warmTest_HazelJit slow tests, Node 22, dev build of trial/694-view-jit (4c0ed173f1), laptop; interpreter without the app's call memo045#speedmitigated on trial/694-view-jit (hazel-jit, off #2635), not merged
A small rule on Hazel's interpreter vs compiled code358 µs a call (evaluate_open) vs hazel-jit 1.59 µs, hand-written JS 0.90, ReScript 0.55, Melange 0.46 µs (225x hazel-jit)^report(43)'s Petri net rule, 2,000 events, Node 22, laptop046#speed (also 045#hand)mitigated on trial/694-view-jit
The Witch picture's view on the interpreterHazel test: a frame 155 ms (6 fps) vs 3.4 ms compiled (45x), most of it the command evaluating the splice's value; Firefox: 87 ms (11 fps) vs 3.0 ms (29x); polygon editors 26-29 ms vs 0.29-0.45 ms. Corrected 11-07 13:28: the frame is the Hazel test's process, not the app; before cb560ebb86 every Firefox render took 90 ms on the interpreterTest_HazelJit witch_view_run, Node; Firefox on GitHub, release build, trial/694-view-jit046#witch-frame (also 046#witch-firefox)mitigated on the trial (compiled views)
The program's run on the evaluator in the worker1.2-2.6 s of a 5.3-8.8 s small edit (18-20%, 1.1-1.3 s on the neck edits); after two changes 1.0-1.1 s (44-56%); with sharing dropped 0.81-0.92 s (50-64%), now the largest costWitch slide small edits, Firefox on GitHub, release build, trial/694-view-jit046#witch-edit-parts (also 046#witch-trip, 046#witch-cuts, 047#goal)open
An interpreter that pays for the editor at every step: persistent maps and allocation (GC) (7)
the costwhat it costsmeasured onreportwhere it stands
Garbage collection during view evaluation21% of the page's main threadwoods, #2635, Gecko profile005#updateopen
ValueHash keeps hashes in a JS WeakMap side table that slows as it growsidentical woods evaluations 2.3, 5.5, 6.3 s in one session (17.2 s after two slides) as the heap grew 685 MB -> 1.2 GB; corrected 2026-10-13: the '23 times slower' was the table, not derived namesScenes woods with derived names, Node, local branch of #2635009#merklefixed in the experiment only (hashes on values: 2.2, 2.5, 2.2 s); production ValueHash still a WeakMap
Whole-program memos (Statics.mk keeps 16 programs, MakeTerm 8 parses) fill upabout 19 MB per edit until they reach their boundsFull Body slider edits, headless Chromium, #2597014#cachesbounded by design; held to one entry, redraws took 18-31 s
Garbage collection in the boundary floor and in a plain walk18% of the floor (with 'the rest'); 19.8% of self time in a held-list walk; 2.45/2.54/2.39 ms per identity call16x16 floor profile; 136-step walk over a held list, dev build, Node025#flooropen
Garbage collection on every pass (a trampoline closure, a state record, a fresh term per result)36% of a loop's profile (count(5000): 1,032 of 2,836 ms); 15.8% of sumbuild(1000); 13.7% of h_refprofiles through the JS library, Node, embed-520's dev build029#hazel-step (also 035#where)open
Garbage collection and the rest, in the undo probe370 ms, 27% (375 ms, 21% before)same profile, #2635036#whereopen
The same compiled view runs 6x slower inside Hazel's process (likely its heap and GC)1.16 ms vs 0.19 ms in a benchmark processWitch view, Hazel test vs plain Node046#witch-frameunknown (cause a guess)
An interpreter that pays for the editor at every step: trampolines and stack safety (4)
the costwhat it costsmeasured onreportwhere it stands
Eight fresh stage closures per node; pass-through stages add trampoline bouncescall-heavy benchmark 499 ms min, 607-644 ms median before; agenda 037: dev takes 206,834 steps on the PerfBudgets program against 96,438 on #2635call-heavy program (2,000-element list, recursion 3,000 deep), Node, #2635; PerfBudgets test (#2678)001#next (also 037#3-why-2635-s-evaluator-takes-half-dev-s-steps-on)fixed on #2635/#2597 (2d35bb9e01, 602498d7aa): -16% min, -25% median; PR #2793 to dev open
The trampoline in the evaluator's stepstrampoline run 3.5% + bind 2.6% of self timeas above025#callopen
Trampolines for stack safety (about five closures and continuations per pass)11.7% of a loop, 22.4% of h_ref, 3.5% of sumbuildsame profiles035#whereopen
The stack overflows on long let chains and large modulesStack_overflow at 8x Common (184 lines) after an edit (032); ~150 module members overflow Node's default stack (034, 039); the undo probe at 6,400 definitions crashed 4 of 6 runs with an 8 MB stack (036)the game's Hazel build on GitHub; hazeljs in Node; Test_UndoScaling on #2635032#scale (also 034#release-found, 036#method)open (^ticket(591))
An interpreter that pays for the editor at every step: data representation (flat lists, no maps) (4)
the costwhat it costsmeasured onreportwhere it stands
The picture is a flat list of shapes in absolute coordinates, so moving a part moves every pointone slider changes up to 113 of 133 shapes (a group tree: at most 14 nodes); arm-angle trace distance 20,206 vs 5,104 steps on the treeslider sweep (011); Full Body rebuilt as groups (012); steps011#representation (also 012#scratch)open; the tree is an experimental slide; flattening it for today's renderer erases the gain
Walks over the picture's lists rerun down to the last changed shapelists as named cells would take 10.1% off the update (to 1,509,299 steps over 63 edits); 0.6 points median, at most 5.163 slider edits, Node oracle011#cellsopen
A game rule scans a list each call (no map)0.7 ms per pull with 10 links, 5.7 ms with 100, 65 ms with 1,000lever-to-trapdoor rule, #2635 test build, Node on a GitHub runner020#playunknown
Hazel has no map, so a rule walks a list to find a square254 ms at 64x64 held, 346 ms passed, against Fumola's held HashMap at 0.54 ms (471x and 641x)World rule 3x3 to 64x64, Node, trial/r25-best vs Fumola wasm027#numbersopen; a balanced map on a trial gave ~1 ms a move (030)
Other: other (8)
the costwhat it costsmeasured onreportwhere it stands
Jumping to a projector walked the caret token by token~190 ms per projector clickeditor001#issuesfixed by #2602, merged to dev
Slide code found the head's frame per point instead of onceEyes sliders 1.5-1.8 sEyes slide, #2635002#facefixed in the slide: 0.5-1.2 s
Hands redraw grows with the finger count (not profiled)about 0.3 s per finger; 99 fingers 32.30 s against 5 ms in the game; 100 claws 8.19 sHands slide, #2635, headless Firefox, single runs003#costopen, not profiled
Autosave prints the whole program inside the change; with probes the print was quadratic in top-level itemsabout 600 ms a change (whole program) and about 1 s (GUI only); updated 2026-10-14 from 0.55 sFull Body, #2635, headless Firefox008#updatefixed (ec9f125acd): about 80 ms
The library's size and loadhazel-lib.js 2.8 MB; page load ~525 vs 270 ms (Hazel vs JS); heap 67 vs 51 MB; 643 KB over the wire (034)shipped Dress Up, Chrome on GitHub025#t-game (also 034)open
Hazel's tiles in the game: a whole Hazel app per script box, made one at a time~3.7 s for six boxes (3.0-4.5 s); the run ~4 s longer than with JS (17.4 vs 13.1 s)Dress Up Scripting tab, Chrome headless on GitHub032#tableopen
The app evaluated the whole livelit definition on every event before applying its update68.3-83.3 ms per event for the Polygons livelit (its update alone 0.67-5.18 ms); a drag step 80.7 msPolygons livelit, twelve actions, Node, trial/694-view-jit045#difffixed on the trial (update compiled, new model back as a diff, ^ticket(715), 4c0ed173f1): 0.023-0.081 ms; a drag step 0.050 ms
hazel-jit's own output: an array per call of a tuple function, generic equality, no loops for tail calls, boxed options1.59 µs a call, 2.9x ReScript's 0.55 µs; 9% behind ReScript on the Witch viewPetri rule and Witch view, Node 22, laptop046#speed (also 046#suggests)open (five changes proposed)

How this was put together#