PulseCore

Chapter 8 · Section 15

Where a Frame's Time Goes

Measured (2026-11-17, a level 202 run, headless, a CPU profile of the physical phase, 60 s). The physics was an eighth of the main thread: the stars' step with its mass draws about 5 %, the matter's step about 4 %. The drawing's own JavaScript was over 40 %: placing the galaxies' ~50,000 points by hand each frame 13 %, uploading every point buffer to the card each frame 16 %, tracing the wave rings 9 %. The page ran its long tasks for 47 % of the time. So the stars looked stationary not because the physics was slow but because the drawing left no frames between its steps, and the galaxies' turn was tied to the flips the physics managed.

The galaxies' stars swirl on the graphics card. Each star's orbit is written once (its share of its galaxy's reach, its angle, its own rate, its birth and death); each frame the page writes eight numbers a galaxy into a small texture (centre, reach, pattern angle, turn, fall, column scale, dimming) and the card places every star on the torus from those by the same equal-area map, read from a table texture. The same picture by the same rules (Part 8.6); no point buffer is uploaded per frame.

The turn keeps the pace. The paced loop tells the scene the flips a millisecond the life is played at, and the galaxies turn by that whenever the universe runs, held to the eye's limit as before; the achieved rate stands in when no pace is given. The wave rings are traced on alternate frames. The paced loop's wait counts the physics' time, not the frame's drawing, which it had doubled. The mass function is read from a table of 8,192 steps in log mass instead of three or four powers a draw.

Untested on a real graphics card: measured only in software rendering, where the card's work runs on the CPU too.

The physics runs in slices on the frames (2026-11-17, the author, on his own machine after the change above: "the stars are still holding, spread the physics out"). The remaining holds were the physics' own: at level 202 a matter sub-step took about 90 ms and its stars 70–150 ms, four of each a flip, and the page froze through every one, so the galaxies' turn stopped ten times a flip however the stars were placed. The matter's step and the stars' step are now written as runs of pieces (generators) that yield between their phases and every 256 bodies; a piece runner resumes the run on each animation frame for at most 8 ms and leaves the rest for the next frame, so the scene draws between every slice (a budget of half the frame's gap, 8–40 ms, was tried and measured worse: longer holds, the physics no faster). The physics is the same step in the same order: nothing else moves the matter while a run is out, and Stop finishes the run whole. The wait after a piece is gone, since the budget itself is the half-time rule.

Measured (headless, level 202, the universe phase of ~100 s, long tasks by the browser's own observer, >50 ms): before, 268 holds filling 49 % of the time, the longest 3.6 s; after, 86 holds filling 14 %, the longest 0.9 s. What is left whole is the wells' sweep (~140 ms) and the flip itself (~120 ms), once a flip each. In software rendering the physics advanced more slowly in wall time (a frame there is slow, so its half is small); on a real card a frame is about 16 ms and the physics keeps the share it had. Untested there.

The wells' sweep and the skin, too (2026-11-17, the author, after the change above: "still a stutter twice a flip, slice the wells and flip too"). The two holds left were the wells' sweep (~140 ms at level 202: each well's reach found among its neighbours, then the data turned and drawn in ring by ring) and the flip (~120 ms, of which ~95 was painting the torus's skin: every glowing clump's reach, then every cell). Both are now runs of pieces as well: the sweep yields every 64 wells in the reach search and every 16 in the turn and infall; the paint yields every 256 clumps and every 16 rows, and in the paced life the flip no longer paints, it leaves the paint to the tick as a run of its own, which the scene's idle loop shows when it is in. The flip itself keeps its field step, its finds and its draw, about 25 ms. As before, nothing else touches the field while a run is out. Measured headless as above: long holds 16 % of the universe phase (14 % after the first slicing, 49 % before), 78 holds against 86 and 268, with no page errors; in software rendering the frames' own drawing is most of what is left, so the gain of these two must be seen on a real card. Untested there.