Skip to content

Life 15: the engine in a worker thread [LIFE15-Worker-069] - #90

Merged
NeoLorenzo merged 1 commit into
mainfrom
life15-worker
Oct 28, 2026
Merged

NeoLorenzo merged 1 commit into
mainfrom
life15-worker

Conversation

@NeoLorenzo

Copy link
Copy Markdown
Owner

Update 069: the Life engine runs in a Web Worker, so frames no longer wait for it.

What changed

  • engineWorker.ts runs the engine. The page keeps the clock and asks for a goal 0.1 s ahead at the speed shown. The worker runs in slices of at most 50 ms and sends a view copy every stride (the speed over 60 minutes, at least one).

  • viewCopy.ts builds the view copy, which keeps only what the page reads:

    • the routes of walks under way;
    • each person's next wake-up;
    • exchanges and walk records;
    • current memory for the followed person only.

    It travels as its changes from the last copy, and engineLink.ts applies them on the page.

  • Playback functions in valleyViewModel.ts replace the per-frame engine step. The page draws the newest copy at or before the clock. When the worker is behind, the clock waits and the page keeps drawing.

  • The loading card stays until the worker has built its valley.

  • The engine is unchanged, so every fingerprint stays the same.

Measured (off-screen Chrome, production builds, main → this branch)

  • 1 month/s, days 5–36: 15–19 fps → 52–60 fps
  • Past day 36: 16 fps → 54 fps; 3.3 → 2.9 days a second (single runs)
  • 1 day/s: 47 → 58 fps
  • Start to first view: 7.4 → 12.2 s

Not settled

  • The engine itself is no faster.
  • Start is about 5 s slower, because the loading card waits for the worker's own build.

npm run agent:check passes.

@NeoLorenzo
NeoLorenzo merged commit f01233c into main Oct 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant