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

Toward 60 fps: hazel-jit So Far

Can you drag a livelit's slider in Hazel and watch its picture follow at 60 frames a second, as it would on a page written in JavaScript? Not yet, but close: on the Witch slide, a drag now runs at 48.4 frames a second with the picture following, up from 9.8 earlier the same day. This report follows eight builds of one branch, each measured the same way, and says what is left. It puts ^report(45) to ^report(49) together, and asks you to try it. Matthew's goal, 2026-11-08: "I'd really like Hazel to have a floor of 60FPS for small edits (sliders changing), just like in JS (but well beyond there, obviously)."

Try it yourself. The latest build (build 8, below) runs in your own browser, with a frame-rate overlay at top right that shows the frames your browser draws: the Witch slide, compiled, and, to compare, the same with nothing compiled. Drag a slider (the neck, the arms) and watch the picture and the overlay. Every slide of the Livelit Playground is linked the same way in hazelgrove/hazel#2819, which hosts this build; the overlay goes on with ?hud in the address, and is also hazelgrove/hazel#2818, for dev.

Outline#

  1. What the Witch draws: the slide every number here is measured on, 2,222 lines of Hazel with 53 livelits and one picture of 133 shapes.
  2. Where it stands: on the latest build, a drag at 48.4 frames a second with the picture following, and a step in 176 to 290 ms; not yet a floor of 60.
  3. Compiled code is fast: hazel-jit runs Hazel code 29 to 1,140 times faster than the interpreter, and the slide's whole run is 2.2 ms of a frame.
  4. Eight builds, one change each: how a step went from 4.17 to 6.52 s to 176 to 290 ms, and a drag from 9.8 to 48.4 frames a second.
  5. Where the time goes now: the page's own work, in a drag's frame and in a step.
  6. Why it was slow: many costs from four design choices, and values as data.
  7. What next: eight changes, in the order that reaches 60 fps, each with the time it would take away and how it has gone (five tried on 11-09, in ^report(51)); the five reports; and how this was put together.

What the Witch draws#

The Witch slide's picture: a green-faced witch in a purple hat and dress with web patterns, black boots, drawn as 133 polygons and lines

The Witch slide is a Hazel program of 2,222 lines whose 53 livelits (33 sliders, choices, polygon editors and the picture) draw one figure of 133 shapes. A step of the neck slider changes 17 of the shapes; a step of the arms, 30. The picture is a livelit too: its view draws the figure the program computes from every slider. It began as a game Matthew's children, M and N, design (Messed Up Dress Up), ported to Hazel (^report(4)) so that its pieces are live code.

The drawing at left is the picture's own output, the same from Hazel's interpreter, from hazel-jit's JavaScript, and from three other compilers and JavaScript written by hand (^report(46)). Below, the same program with its choices changed, drawn by Hazel.

Five witches: the default; with a cat and a broom; nose out, 200; other colours; a cat at 400 and a broom at 300
The Witch slide's picture with five settings of its livelits, drawn by Hazel (^report(4), 2026-10-11).

Where it stands#

On build 8, the latest, a 3-second drag of the Witch's neck slider runs at 48.4 frames a second with views and the slide's run compiled, and the picture follows the slider at every frame. Its median frame is 17.1 ms, one display frame: 116 of its 146 frames (79%) fit in one 60 fps frame, and the other 30 take two to 4. So it is not yet a floor of 60 frames a second, but most of the way there.

With nothing compiled, the same drag runs at 57 frames a second, but only the slider moves: the picture waits for the worker to run the program after the release. A single step of a slider, as a click gives it, shows in the picture 176 to 290 ms after the click, against 1.12 to 1.56 s with nothing compiled. That is still 11 to 17 frames at 60 fps (why).

Build 8: every frame of a 3-second drag of the Witch's neck slider, in Firefox, one tick a frame (a log scale)compiled: the picture follows146 frames in 3.0 s: 48.4 fps; median 17.1 ms, 90th percentile 33.3 ms, longest 66.4 ms; 116 of 146 in one 60 fps framenothing compiled: it waits171 frames in 3.0 s: 57 fps; median 17.1 ms, 90th percentile 17.1 ms, longest 66.4 ms; 165 of 171 in one 60 fps frame10 ms16.7100 ms1 s
Build 8 (change C, 61f3f01a15), run 42566328043. Green: one display frame; amber: two; red: three or more. A frame of about 16 or 17 ms is the display's own pace, 60 a second; nothing can be quicker.
The Witch slide in Firefox during a drag of the neck slider on build 8, compiled, the overlay reading 42 fps
Build 8, compiled: halfway through a drag, the picture in view. The overlay reads 42 fps over the last second, the longest frame 66 ms; over the whole timed drag, 48.4 fps (run 42566328043).
The same drag on build 8 with nothing compiled, the overlay reading 58 fps
Build 8, nothing compiled: 58 fps, the longest frame 34 ms; but the picture does not follow the drag, it waits for the worker after the release.

The overlay is a few lines of JavaScript, on with ?hud in the address: the frames the browser drew in the last second, the longest of them, and two seconds of frame times as bars against a line at 16.7 ms, red above two frames. It times frames as the browser draws them, so a page busy for 300 ms shows as one 300 ms frame. It is how you can check any number here yourself (try it).

Compiled code is fast#

hazel-jit turns Hazel code into JavaScript that runs 29 to 1,140 times faster than Hazel's interpreter; the Witch's whole run, about 112 times faster. On build 8, the slide's whole run, compiled, takes 2.2 ms of a drag's frame. That is why the picture can follow a drag at all. It also means the run no longer stands between Hazel and 60 fps: the page's own work around it does (where the time goes now).

A view compiled is drawn straight from its JavaScript, never made a Hazel value again (^report(45)). In Firefox, compiled views draw what the interpreter draws: the check compares every livelit's drawing on every polygon slide both ways, and found 0 differences in builds 4 to 8.

The same Hazel code on Hazel's interpreter (grey) and as hazel-jit's JavaScript (teal), each as its report measured it (a log scale)a recursive sum of 1,000 numbers (Node)a recursive sum of 1,000 numbers (Node): 47.9 to 47.9 msa recursive sum of 1,000 numbers (Node): 0.042 to 0.042 msabout 1,140 times (045)the Petri net rule, four events (Node)the Petri net rule, four events (Node): 7.19 to 7.19 msthe Petri net rule, four events (Node): 0.011 to 0.011 msabout 654 times (045)the Polygons view, a render with its trip (Node)the Polygons view, a render with its trip (Node): 13.7 to 13.7 msthe Polygons view, a render with its trip (Node): 0.34 to 0.34 msabout 40 times (045)the Witch's polygon editors' views (Firefox)the Witch's polygon editors' views (Firefox): 26 to 29 msthe Witch's polygon editors' views (Firefox): 0.29 to 0.45 msabout 76 times (046)the Witch's picture view (Firefox)the Witch's picture view (Firefox): 87 to 87 msthe Witch's picture view (Firefox): 3 to 3 msabout 29 times (046)the Witch's whole run (Node)the Witch's whole run (Node): 502 to 529 msthe Witch's whole run (Node): 4.2 to 5 msabout 112 times (045)16.7 ms10 µs0.1 ms1 ms10 ms0.1 s1 s
Not a build of the app: each row is one piece of Hazel code run two ways. Medians in Node 22 on a laptop (^report(45)), and renders in Firefox in the app (^report(46)). A render's time is its view's work alone, as if the update were free. The ratio is of the middles of the ranges.

Close to ReScript and Melange#

On one rule of a Petri net, hazel-jit's code takes 1.59 µs a call: 2.9 times ReScript's, 1.8 times JavaScript written by hand, and 225 times less than Hazel's interpreter. On the Witch's picture view, all five compilers are within 15% of one another, since most of the work is one builtin. ReScript's and Melange's ways of laying out values are the models for what hazel-jit makes next (^report(46)).

One call of report 043's Petri net rule, median µs, in Node (report 046; a log scale)MelangeMelange: 0.46 µs0.46 µsReScriptReScript: 0.55 µs0.55 µsjs_of_ocaml (a best case)js_of_ocaml (a best case): 0.71 µs0.71 µsJS written by handJS written by hand: 0.9 µs0.9 µshazel-jithazel-jit: 1.59 µs1.59 µsHazel's interpreterHazel's interpreter: 358 µs358 µs0.1 µs1 µs10 µs100 µs1 ms
Not a build of the app: each answers the same 2,000 events and ends on the same marking (^report(46), how fast). js_of_ocaml's is a best case: it inlined the rule into the timing loop.

Eight builds, one change each#

This report's own figures come from eight builds of one branch, trial/694-view-jit, each the build before it plus one change, and each measured the same way in Firefox on GitHub's machines on 2026-11-08. Over them, a slider's step went from 4.17 to 6.52 s to 176 to 290 ms, and a drag from 9.8 to 48.4 frames a second. Every build compiles livelit views (^report(45)); "nothing compiled" means the same build with Compiled views turned off. Each figure names its build by number.

buildwhat it adds to the build above ita step, compileda drag, compiled
1 · the branch as it was
dfa3fcdffe, run 42486001354, 11-08 06:39
Livelit views compiled (^report(45)). The picture waits for the worker's answer: the whole program run on the interpreter, its result sent back as 5 MB of terms.4.17 to 6.52 s
compiled views or not: the picture waited for the worker
not measured
2 · the answer trimmed
20a3067c18, run 42490487136, 11-08 07:34
Two changes to the worker's answer: no function-holding values in the samples' environments, and no trace (^report(46)).1.85 to 2.38 s
compiled views or not: the picture waited for the worker
not measured
3 · the answer unshared
4747a4120d, run 42492117212, 11-08 07:54
The worker's answers no longer shared (^report(46)).1.33 to 1.71 s
compiled views or not: the picture waited for the worker
not measured
4 · the run compiled
6d71c427bf, run 42551267058, 11-08 19:29
The slide's whole run compiled to JavaScript in the page, each livelit's model a parameter, and called at a livelit's event, so every livelit draws from its answers (^report(49)). A step back to a slider's starting value is still taken for an undo, and waits for the worker.318 to 469 ms
steps back: 1.66 to 1.69 s
nothing compiled: 1.90 to 2.24 s
not measured
5 · steps back kept
bb88edfd12, run 42556616487, 11-08 20:28
A step back keeps the run's answers (a51dc778dd, ^report(49)); and the frame-rate overlay, and the timed drag in the check, which change nothing else in the app.208 to 400 ms
nothing compiled: 1.14 to 1.51 s
9.8 fps
nothing compiled: 6.1
6 · change A
9fca635226, run 42560502616, 11-08 21:12
A drag's input events go to the page as a request to draw again, not to the editor as an edit of the program.223 to 416 ms
nothing compiled: 1.56 to 1.96 s
22.5 fps
nothing compiled: 15.2
7 · change B
38d4e4d0f8, run 42562102280, 42563736665, 42564711121, 11-08 21:29
Each livelit has its own version in the views' cache, so a frame draws again only the livelits whose answers changed, not all 53.245 to 434 ms
nothing compiled: 1.63 to 1.99 s
26.4 fps
nothing compiled: 21.3
again: 34.3 and 26.2
8 · change C
61f3f01a15, run 42566328043, 11-08 22:16
The projectors' data and finished views kept from frame to frame while nothing they read has changed (bdecaec5d9, 61f3f01a15).176 to 290 ms
nothing compiled: 1.12 to 1.56 s
48.4 fps
nothing compiled: 57

The builds come in three stages:

A slider's step on the Witch, from the step to the picture showing it, build by build (Firefox; a log scale)the picture from the worker's answerthe picture from the slide's run, compiled, in the page1 · the branch as it wasbuild 1: a step at 6402 ms (run 42486001354)build 1: a step at 5613 ms (run 42486001354)build 1: a step at 4169 ms (run 42486001354)build 1: a step at 5208 ms (run 42486001354)build 1: a step at 6520 ms (run 42486001354)build 1: a step at 6313 ms (run 42486001354)build 1: a step at 4925 ms (run 42486001354)build 1: a step at 5535 ms (run 42486001354)4.17 to 6.52 s2 · the answer trimmedbuild 2: a step at 2091 ms (run 42490487136)build 2: a step at 1910 ms (run 42490487136)build 2: a step at 1911 ms (run 42490487136)build 2: a step at 1851 ms (run 42490487136)build 2: a step at 2383 ms (run 42490487136)build 2: a step at 2001 ms (run 42490487136)build 2: a step at 2149 ms (run 42490487136)build 2: a step at 1979 ms (run 42490487136)1.85 to 2.38 s3 · the answer unsharedbuild 3: a step at 1484 ms (run 42492117212)build 3: a step at 1350 ms (run 42492117212)build 3: a step at 1424 ms (run 42492117212)build 3: a step at 1326 ms (run 42492117212)build 3: a step at 1714 ms (run 42492117212)build 3: a step at 1381 ms (run 42492117212)build 3: a step at 1495 ms (run 42492117212)build 3: a step at 1356 ms (run 42492117212)1.33 to 1.71 s4 · the run compiledbuild 4: a step at 469 ms (run 42551267058)build 4: a step at 1659 ms (run 42551267058)build 4: a step at 318 ms (run 42551267058)build 4: a step at 1694 ms (run 42551267058)318 ms to 1.69 s5 · steps back keptbuild 5: a step at 400 ms (run 42556616487)build 5: a step at 236 ms (run 42556616487)build 5: a step at 232 ms (run 42556616487)build 5: a step at 208 ms (run 42556616487)208 to 400 ms6 · change Abuild 6: a step at 416 ms (run 42560502616)build 6: a step at 257 ms (run 42560502616)build 6: a step at 271 ms (run 42560502616)build 6: a step at 223 ms (run 42560502616)223 to 416 ms7 · change Bbuild 7: a step at 434 ms (run 42562102280)build 7: a step at 284 ms (run 42562102280)build 7: a step at 283 ms (run 42562102280)build 7: a step at 245 ms (run 42562102280)245 to 434 ms8 · change Cbuild 8: a step at 290 ms (run 42566328043)build 8: a step at 182 ms (run 42566328043)build 8: a step at 176 ms (run 42566328043)build 8: a step at 222 ms (run 42566328043)176 to 290 ms16.7 ms: one 60 fps frame10 ms0.1 s1 s10 s
One dot a step: the neck and arms sliders each stepped away from their starting value and back, with views compiled; for builds 1 to 3, those four steps both with views compiled and not, since the picture waited for the worker either way. The step is the slider's input event and its change event together, as a click on the slider gives them. One run a build, Firefox on GitHub's machines, a release build each time; the runs are in the table of builds.

A drag, build by build#

The three changes took a compiled drag from 9.8 to 48.4 frames a second, its median frame from 99.6 to 17.1 ms. With nothing compiled, a drag went from 6.1 to 57; that drag does less, since only the slider moves. Single runs vary: build 7, measured three times without changing the app, gave 26.2, 26.4, 34.3 frames a second compiled. So a step's times for builds 5 to 7 are within that noise (changes A and B were for a drag's input events, not a step); build 8's steps were the quickest so far, but one run each is not enough to say by how much.

A 3-second drag of the Witch's neck slider, frames a second, build by build (Firefox)views and the run compiled: the picture follows the dragnothing compiled: only the slider moves; the picture waits for the release5 · steps back keptbuild 5, compiled: 9.8 fps, median frame 99.6 ms (run 42556616487)9.8 fps, median frame 99.6 msbuild 5, nothing compiled: 6.1 fps, median frame 116.6 ms (run 42556616487)6.1 fps, median frame 116.6 ms6 · change Abuild 6, compiled: 22.5 fps, median frame 49.3 ms (run 42560502616)22.5 fps, median frame 49.3 msbuild 6, nothing compiled: 15.2 fps, median frame 66.4 ms (run 42560502616)15.2 fps, median frame 66.4 ms7 · change Bbuild 7, compiled: 26.4 fps, median frame 33.3 ms (run 42562102280)build 7 again, the same app with the page's view timed part by part: 34.3 fps (run 42563736665, fa2614e1f6)build 7 again, the same app with a first try at change C whose memo missed every frame: 26.2 fps (run 42564711121, bdecaec5d9)26.4 fps, median frame 33.3 msbuild 7, nothing compiled: 21.3 fps, median frame 49.4 ms (run 42562102280)build 7 again, the same app with the page's view timed part by part: 25.5 fps (run 42563736665, fa2614e1f6)build 7 again, the same app with a first try at change C whose memo missed every frame: 26.2 fps (run 42564711121, bdecaec5d9)21.3 fps, median frame 49.4 ms8 · change Cbuild 8, compiled: 48.4 fps, median frame 17.1 ms (run 42566328043)48.4 fps, median frame 17.1 msbuild 8, nothing compiled: 57 fps, median frame 17.1 ms (run 42566328043)57 fps, median frame 17.1 ms60 fps0153045
The same drag each time: one input event a frame as the slider sweeps from 0 to 60 and back, and one change event at the end, as a browser delivers a drag; every frame timed with requestAnimationFrame, as the overlay times it. One drag each way in each build's run. The open circles are build 7 measured twice more, the app unchanged: 34.3 fps compiled in run 42563736665 (the same app with the page's view timed part by part); 26.2 fps compiled in run 42564711121 (the same app with a first try at change C whose memo missed every frame). So one run can differ from the next by a third, and a single run's number is a reading, not a constant.
The Witch slide in Firefox during a drag of the neck slider on build 5, compiled, with the frame-rate overlay at top right
Build 5, compiled, before the changes: halfway through the same drag, the overlay reads 9 fps, the longest frame 283 ms (run 42556616487).
The Witch slide in Firefox during a drag of the neck slider on build 5, nothing compiled, with the frame-rate overlay
Build 5, nothing compiled: 9 fps, the longest frame 217 ms, at the moment of this screenshot; over the whole drag, 6.1 fps.

Where the time goes now#

On build 8, a drag's frame is the page's own view, 10.1 ms, the compiled run, 2.2 ms, and about 4 ms of the browser's own drawing. The view is rebuilt from the whole page's state at every frame, though a drag changes only a few livelits, and it is most of each frame.

Build 8: a compiled drag's median frame, 17.1 ms, and where it goes (per frame, over the drag)the page's view: 10.1 msthe slide's run, compiled: 2.2 msafter display: 0.3 msupdate: 0.1 msthe rest: the browser's own diff, layout and paint (not timed): 4.4 msthe page's view: 10.1 msthe slide's run, compiled: 2.2 msafter display: 0.3 msupdate: 0.1 msthe rest: the browser's own diff, layout and paint (not timed): 4.4 ms16.7 ms
Build 8, run 42566328043: the page's timeline (Util.BenchMarks) summed over the drag and divided by its 146 frames. The rest of the median frame is the browser's own work after the view, which the timeline does not time.

A step takes longer than a drag's frame because its change event is still an edit of the whole program. In a click, the input and change events come together. The input is handled as in a drag: the compiled run, then a redraw. The change goes to the editor: statics and syntax (32 ms), then the whole slide's view (91 ms), all before the browser can paint, at 176 ms. After the paint, the page compiles the program again (126 ms), and the worker still runs it; its answer, at 1.08 s, draws the same picture again.

Build 8: one step (arms (up / down) 55 to 65, compiled): the picture at 176 ms, the worker's answer at 1.08 sthe slide's run, compiledhazel-jit: the run: 6 ms at 2 mshazel-jit: the run: 2 ms at 9 msthe page: update, statics, viewupdate: 0 ms at 13 msview: 18 ms at 13 msupdate: 8 ms at 31 msstatics: 16 ms at 39 mscalculate: 32 ms at 39 mssyntax: 12 ms at 55 mscursor info: 0 ms at 71 mscolor map: 0 ms at 71 msview: 91 ms at 71 msafter display: 3 ms at 172 msafter display: 0 ms at 311 msupdate: 0 ms at 327 mssyntax: 8 ms at 327 mscalculate: 61 ms at 327 mssyntax: 12 ms at 376 mscursor info: 0 ms at 388 mscolor map: 0 ms at 388 msview: 63 ms at 389 msafter display: 0 ms at 463 msafter display: 0 ms at 469 msafter display: 1 ms at 477 msafter display: 0 ms at 493 msafter display: 0 ms at 509 msafter display: 0 ms at 526 msafter display: 0 ms at 542 msafter display: 0 ms at 559 msafter display: 0 ms at 576 msafter display: 1 ms at 592 msafter display: 0 ms at 610 msafter display: 1 ms at 625 msafter display: 1 ms at 642 msafter display: 1 ms at 658 msafter display: 1 ms at 675 msafter display: 1 ms at 693 msafter display: 1 ms at 709 msafter display: 0 ms at 727 msafter display: 0 ms at 743 msafter display: 0 ms at 760 msafter display: 0 ms at 776 msafter display: 0 ms at 793 msafter display: 0 ms at 809 msafter display: 1 ms at 826 msafter display: 0 ms at 843 msafter display: 1 ms at 859 msafter display: 1 ms at 876 msafter display: 1 ms at 892 msafter display: 1 ms at 909 msafter display: 0 ms at 926 msafter display: 0 ms at 943 msupdate: 0 ms at 968 mssyntax: 6 ms at 968 mscalculate: 15 ms at 968 mssyntax: 7 ms at 975 mscursor info: 0 ms at 983 mscolor map: 0 ms at 983 msview: 88 ms at 983 msafter display: 0 ms at 1079 msthe edited program compiled againhazel-jit: the run compiled: 126 ms at 184 msthe worker: its runworker: request decoded: 1 ms at 71 msworker: request decoded: 1 ms at 72 msworker: encode ack: 0 ms at 73 msworker: post ack: 0 ms at 73 msworker: request composed: 28 ms at 73 msworker: reuse plan: 14 ms at 101 msworker: slices: 117 ms at 101 msworker: encode reuse plan: 6 ms at 109 msworker: post reuse plan: 0 ms at 115 msworker: encode stream: 1 ms at 217 msworker: post stream: 0 ms at 218 msworker: slices: 34 ms at 218 msworker: slices: 30 ms at 252 msworker: slices: 30 ms at 282 msworker: slices: 31 ms at 317 msworker: slices: 30 ms at 352 msworker: slices: 30 ms at 386 msworker: slices: 30 ms at 420 msworker: slices: 31 ms at 454 msworker: slices: 31 ms at 489 msworker: slices: 136 ms at 524 msworker: slices: 32 ms at 665 msworker: slices: 30 ms at 701 msworker: slices: 65 ms at 734 msworker: slices: 64 ms at 802 msworker: make result: 0 ms at 884 msworker: post result: 1 ms at 954 msthe answer: encoded, decodedworker message decoded: 0 ms at 184 msworker message decoded: 1 ms at 314 msworker message decoded: 0 ms at 317 msworker: encode result: 70 ms at 884 msworker message decoded: 13 ms at 954 msthe slider and the picture drawn, 176 msthe worker's answer, 1079 ms16.7 ms
Build 8, run 42566328043: the quickest of its four steps, from the page's own timeline and the worker's (Util.BenchMarks), each block a measured piece of work at the time it started; the worker's blocks are on its own thread, the rest on the page's. ^report(49) has the same figure for build 4's app.

Why it was slow#

The series has measured 196 separate costs in Hazel, from four design choices each applied everywhere: values held as terms, whole-program work on every edit, values moved as terms across boundaries, and an interpreter that pays for the editor at every step. Many are most of the work they were found in, and many make one another larger (^report(48)). Compiling the run (builds 4 and 5) took the fourth out of a slider's step; changes A to C (builds 6 to 8) took some of the second out of a drag. The second is most of what is left.

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
Not a build of the app: every cost the series has measured in Hazel, one rectangle each, grouped by the design choice it comes from and coloured by where it stands (^report(48)). Hover a rectangle for the cost.

Values as data: held without ids, holes or closures, the Witch's picture is 3 times smaller and its trip 2.5 to 4.3 times quicker; but building values as data saves the evaluator a couple of percent at most, so the run itself had to be compiled (^report(47)).

The Witch's picture as Hazel's terms (grey) and as data (blue): report 047, experiment 1its size, KBterms: 142.2terms142.2data: 48data48its trip by Marshal, encoded and decoded, msterms: 15 to 25.7terms15 to 25.7data: 4.38 to 7.28data4.38 to 7.28
Not a build of the app: the picture's value, held two ways. As data: no ids, no sharing to find, numbers packed (^report(47)); the lighter bar is the slowest of the readings.

What next#

Each is a change to make, in the order that reaches 60 fps on the Witch; the middle column is the time it would take away, as measured on build 8 (or in the report named). On 11-09, in the order Matthew set (3, 4, 7, then 1 and 2), five were tried, as builds 9 to 12 in ^report(51); the status column says how each went. On build 12, a step shows in 19 to 24 ms and a drag's view is 6.1 ms a frame. What had been done before is the eight builds (the table); the last three, changes A to C, were this list's first item in the version of 11-08.

what to do nextwhat it would take away, as measuredstatus
1Draw only the livelits a drag changes. Make the editors' and projectors' views incremental, so a frame no longer rebuilds the view of the whole page.Most of the page's view: 10.1 ms of a 17.1 ms median frame (where the time goes now).first part done 11-09: each editor's decorations and probes' views reused across a drag's frames, the view 6.1 ms a frame (build 12 of ^report(51))
2Handle a slider's change event without an edit of the program, as change A did for its input events, or do the edit's work after the paint.Most of a step: statics and syntax (32 ms) and the whole slide's view (91 ms), all before the paint at 176 ms.done 11-09: the page draws first and makes the edit after the paint; a step shows in 19 to 24 ms (build 12 of ^report(51), ^ticket(721))
3Compile the program once, not again after a step that changed only a livelit's model: the compiled program already takes the model as a parameter.126 ms of the page's thread after each step.done 11-09: kept at every step; 29 to 51 ms of comparing after the paint instead (builds 9 and 10 of ^report(51))
4Leave the worker out when the compiled run has answered: don't run it, or don't draw again from its answer.About a second of the worker's work a step (its answer at 1.08 s), and the page drawing every view again to the same picture.partly done 11-09: the answers kept, the worker's request held; the page still draws a whole view per worker message (build 9 of ^report(51), ^ticket(720))
5Check a step's time and a drag's frames in Firefox on every PR to dev, so they cannot slip back (^report(48)).Nothing by itself; it keeps the rest.the check runs on this branch only (jit.yml); build 8 is hosted for the team by hazelgrove/hazel#2819
6Make hazel-jit's output more like ReScript's and Melange's: their layouts of records, constructors and lists, and fewer calls.On the Petri rule, 1.59 µs a call against ReScript's 0.55 (^report(46)); on the Witch, the run is 2.2 ms of a frame, so little there.not started
7Send values as data where they cross, when the worker does run: its answer and probe samples without ids or sharing.The picture 3 times smaller and its trip 2.5 to 4.3 times quicker, measured outside the app (^report(47)).first slice tried 11-09, and off: the answer grew to 0.89 MB (build 11 of ^report(51), ^ticket(718))
8Merge the performance PRs open against dev.Each PR's own measured gain (^report(48)).open, waiting for review

The five reports#

reporttitleits answer
^report(45)hazel-jit: Livelit Views Compiled to JavaScriptA livelit's view compiled to JS runs 40 to 1,150 times faster than on the interpreter; in Firefox, compiled views draw what the interpreter draws; the Witch's whole run, compiled, 4.2 to 5.0 ms in Node.
^report(46)BuckleScript, ReScript and Melange, beside hazel-jithazel-jit's code is about 2.9 times ReScript's and 1.8 times hand-written JS on the Petri rule; on the Witch's picture all five are within 15%; builds 1 to 3 here: a small edit took 5.3 to 8.8 s, and two changes brought it to 1.3 to 1.7 s.
^report(47)First-Order Data in a Form of Its OwnAs data, the Witch's picture is 3 times smaller and 2.5 to 4.3 times quicker to send; building values as data saves the evaluator a couple of percent at most, so the run itself has to be compiled.
^report(48)Why Hazel Is Slow: A Thousand Cuts196 measured costs from 33 reports, from four design choices applied everywhere; remove the largest and the next is there.
^report(49)The Witch’s Run, Compiled, in the PageBuilds 4 and 5 here: the slide's whole run, compiled and run in the page at a slider's step, 8 to 21 ms; the picture at the page's first redraw, 286 to 386 ms, against 1.35 to 1.74 s.

How this was put together#