Skip to content

Scaling V11 · The page poses and updates only the Souls that show (main thread saturated at 200 Souls) #2618

Open

Description

@genekogan

Tranche: #2504 · Agenda: #1960 · Lane: V (page) · Task: V11 · Ceiling: 4 h (a limit, not a target) · Tier: expected T2; node tools/proof/tier.mjs decides · Depends on: PR 2613 (V9's page harness) merged, or measured on its branch

Main purpose

The page's per-Soul body cost scales with the Souls a viewer can see, not with every Soul in the world.

Problem

V9 (#2554 comment 6920437708, PR 2613):

  • At 200 Souls the main thread is 99–100 % busy in every arm.
  • Each Soul's body (the people kit's show, pose and render) is 27–32 % in the Free view.
  • three.js matrix updates are the largest self-time entries, 15–29 %.
  • Every view is at 13–24 fps at 200 Souls, and about 10 at 500.
  • The JS heap reaches 0.8–1.0 GB at 200 and 1.2–1.7 GB at 500, on phone too.

Acceptance

  • A1. Step 0: per-Soul body cost per frame by part, and how many of the 200 are on screen, or within a distance that matters, in each camera.
  • A2. Pose and matrix updates run only for Souls that show, or at a lower rate for far ones, under a stated rule.
    • A Soul that comes into view is posed correctly on its first visible frame. Test: an off-screen Soul pans into view and its pose matches one updated every frame.
    • Bodies never pop, and none teleport or freeze in view.
  • A3. Bars declared here before the runs. page at 50, 200 and 500 Souls, Free view and Broadcast, desktop and phone, base against candidate, 2 repeats:
    • p50 at 200 Souls under 25 ms on desktop Free;
    • body share at 200 down by at least half;
    • heap reported.

Touches

The people kit's per-frame body update (name the files in A1, likely apps/web/src/gen-mesh/ and apps/web/src/WorldEntityLayer.ts), their tests and changes/. Renderers observe state and never own a second movement path: this changes only how often an observed pose is applied, never where a Soul is.

Stop rule

The standard one: see #2554's stop rule. A visual change needs an uncut, real-speed clip from the runner (the clip command) at T2 or above. Never meet a bar by hiding Souls a viewer should see, or by lowering what the page shows without a stated rule.

Activity

  1. added
    agent:readyTriaged and specified well enough for an agent to pick up
    on Nov 16, 2026
  2. self-assigned this
    on Nov 16, 2026
  3. added
    agent:claimedAn agent or person has claimed this issue; others leave it alone
    on Nov 16, 2026
  4. genekogan commented on Nov 16, 2026

    @genekogan
    MemberAuthor

    V11 lane: started 15:43 UTC 16 Nov; bars and arms declared before any run

    Files (A1 names them). The people kit's per-frame body update is mars/viewer/app/engine-view/humans.ts (HumanViews.render → pose, its pose-rate rule poseDue), reached from take-replay.ts TakePeople.show. Not apps/web/src/gen-mesh/ or WorldEntityLayer.ts: the Souls' bodies are drawn by the people kit. The product change is in humans.ts only, with its test in apps/web/test/body-pose-rate.test.ts.

    Premise found in the code (Step 0, before measuring). A pose-rate rule already exists (PERF-EDEN): bodies within nearM are posed every frame, to farM every 2nd, beyond every 4th, off screen every 8th. Three gaps:

    1. A body that comes into view keeps a stale pose until its rate's next turn, up to 3 frames of a 4-frame rate after up to 7 held frames. A2's test fails on main today: palms 0.05 to 0.35 m off on the first visible frame.
    2. A held body's rig still goes through three's matrix walk and bone upload every frame: updateMatrixWorld recomposes every bone of every body, and each skeleton re-uploads its bone texture.
    3. "Off screen" is judged by the sampled place only, so a held pose drawn at its old place could stay in view.

    Stated rule (the candidate).

    • A body is in the view if its 1.3 m sphere is in the frustum at its sampled place or where it is drawn now.
    • A body that comes into view is posed on that frame, whatever its rate.
    • A body that is neither posed this frame nor in the view is held. Three's matrix walk and bone upload skip its rig until it is posed again, unless its parent moved. Its drawn pose and its shadow stay exactly what they were.
    • Rates are unchanged: in view, every frame / 2nd / 4th by distance; off screen, every 8th. No Soul is hidden, and nothing is drawn at a lower detail. Bodies in the view are untouched, so idle life and the other render-time offsets still apply every frame.

    Arms. These run on souls-timed via timed-run.yml page (V9's harness), cores world=1, 2 repeats each, dispatched together.

    Both measurement branches add the same page timers (measurement only, never for main): per frame, bodies on screen (near / mid / far), posed and held, and the ms of show (sample, setFrame, pose), the bodies' matrix walk and skeleton updates.

    • agent/2618-measure-base = PR 2613's head + the timers.
    • agent/2618-measure-cand = that + this PR's commit.
    arm shape sizes
    base E / cand E event (uneven) 50, 200 (V9: event at 500 restarts the world)
    base U / cand U uniform (even) 50, 200, 500

    Bars. Scored once, as declared; nothing is re-scored.

    • B1. Desktop Free at 200 Souls: the frame p50 (the median of the two repeats' p50s) is under 25 ms in the candidate, in both shapes.
    • B2. Body share at 200 Souls is down by at least half in the candidate, in every tier × camera × shape cell (8 cells), each the mean of 2 repeats.
      • Body share is (show + the bodies' matrix walk + skeleton updates) ÷ the window's wall time, from the page timers.
      • V9's reading is also reported: show inclusive in the CPU profile.
    • B3. The JS heap is reported for every arm, base and candidate.
    • A1. The base arms answer Step 0: body ms per frame by part, and how many of the 200 are on screen and within nearM/farM in each camera.
    • A2. The unit test proves it: an off-screen Soul pans into view at every phase of both rates, and its bone matrices and palms on the first visible frame equal those of a body posed every frame. A held body uploads nothing, and no body in view is held.
      • Clip (T2): clip --kit crowd-pan, base main against candidate (the PR head). 120 Souls gather at the bandstand, and a Free camera turns so the crowd pans into view and out, slowly and then fast. Bodies must not pop, teleport or freeze in view.
  5. genekogan commented on Nov 16, 2026

    @genekogan
    MemberAuthor

    V11 checkpoint, 16:14 UTC: handed back while the page runs finish

    Done.

    • Draft PR 2619 (agent/2618-bodies-that-show, head d21fe5b, T2) carries the change, its test and the crowd-pan clips. The base main and candidate clips are linked in the PR, and A2 is met with evidence.
    • CI: ci-ok is red only because the PR is a draft (the CI window is closed); everything else passes or skips.

    Running (dispatched together at 15:59 UTC, as declared above): page E base / cand, page U base / cand.

    Exact next step. When all four have finished:

    1. Download each run's artifact with gh run download <id> -R soulsimulation/souls -D .local/v11/<id>.
    2. From a checkout of agent/2618-measure-base, run node tools/test-harness/page-souls-v11-score.mjs <baseE> <candE> <baseU> <candU>, each argument being .local/v11/<id>/timed-run-page-<id>. It prints B1, B2, V9's show share, every arm with its heap (B3), A1's Step 0 tables and the candidate's held counts.
    3. Post that output here unchanged and tick A1 and A3 in the PR (met or unmet:).
    4. Write proof.json, upload it, then mark the PR ready and re-add ci:run.
  6. genekogan commented on Nov 16, 2026

    @genekogan
    MemberAuthor

    V11 scored as declared (comment 6921574122); nothing is re-scored

    The four page runs, dispatched together at 15:59 UTC, all succeeded:

    Reading

    • B1: unmet. Desktop Free at 200 Souls is at 66.7 ms (event) and 58.3 ms (uniform). The bar was 25 ms.
    • B2: unmet.
      • In 7 of 8 cells the candidate's body share is 0.75 to 0.93 of base.
      • In event desktop Broadcast it is 1.22. There, the director's shots in the candidate arm had 70 and 53 bodies within nearM (40 m), against 20 and 2.6 in base, and the unchanged rule poses those every frame. Shot choice drives that cell, not the change.
    • B3: met. The heap is reported for every arm.
    • A1: met. The A1 table below has the numbers.
      • At 200 Souls, pose() is most of show(): 6.6 to 21.8 ms of 12.3 to 28.1 ms per frame.
      • The bodies' matrix walk is 2.6 to 4.2 ms per frame, and skeleton updates 1.5 to 3.0 ms.
      • In the Free view the crowd is on screen, 40 to 90 m away: 143 of the 185 drawn bodies in event desktop.
    • The change (A2).
      • The candidate holds 29 to 151 bodies per frame at 200.
      • The bodies' matrix and skeleton ms drop by 30 to 40 % in the Free view, and by 60 to 87 % in uniform Broadcast.
      • Bodies in the view cost what they did, so this change cannot halve body share where the crowd is on screen.
    • 500 Souls. Neither uniform arm has page data at 500. The world on one core went black and made its planned restart (exit 75) before the page arms, as V9 found at 500 in the event shape. That is a server limit, not the page.
    • Noise. Arms differ run to run in crowd and Broadcast shots. For example, event desktop Free had 146 and 143 bodies on screen in base, and 99 and 127 in the candidate.

    B1: desktop Free at 200 Souls, frame p50 (median of repeats; bar: candidate under 25 ms)

    shape base p50 (r1 / r2) cand p50 (r1 / r2) cand median met
    event 66.8 / 66.8 66.7 / 66.7 66.7 no
    uniform 66.6 / 66.6 50.1 / 66.6 58.3 no

    B1 unmet.

    B2: body share at 200 Souls (mean of repeats; bar: candidate at most half of base in every cell)

    shape tier camera base share cand share ratio base body ms/frame cand body ms/frame met
    event desktop broadcast 0.251 0.305 1.22 24.59 33.31 no
    event desktop free 0.409 0.380 0.93 34.84 30.45 no
    event phone broadcast 0.239 0.217 0.91 17.08 17.62 no
    event phone free 0.412 0.316 0.77 25.40 18.37 no
    uniform desktop broadcast 0.260 0.211 0.81 22.98 18.55 no
    uniform desktop free 0.431 0.376 0.87 27.13 22.45 no
    uniform phone broadcast 0.280 0.211 0.75 17.68 12.75 no
    uniform phone free 0.400 0.359 0.90 22.68 20.44 no

    B2 unmet.

    V9's reading: show inclusive share of the CPU profile (first repeat, largest size)

    shape Souls tier camera base cand
    event 200 desktop broadcast 0.234 0.288
    event 200 desktop free 0.296 0.321
    event 200 phone broadcast 0.191 0.183
    event 200 phone free 0.265 0.294

    Every arm: frame p50 / p95, fps, heap (B3), body ms per frame (mean of repeats)

    shape Souls tier camera arm p50 (r1 / r2) p95 (r1 / r2) fps heap MB body ms body share long tasks ms
    event 50 desktop broadcast base 33.4 / 50 83.3 / 83.4 20.9 605.3 7.22 0.153 31169
    event 50 desktop broadcast cand 33.4 / 33.4 83.4 / 83.3 23.1 710.3 6.81 0.155 26221
    event 50 desktop free base 16.7 / 16.7 50 / 49.9 41.8 597.8 7.46 0.310 1573
    event 50 desktop free cand 16.7 / 16.7 50 / 49.9 41.7 655.6 7.03 0.292 1711
    event 50 phone broadcast base 33.3 / 33.4 66.7 / 83.4 26.1 576.5 6.16 0.159 17987
    event 50 phone broadcast cand 33.3 / 33.3 66.7 / 66.7 28.9 842.2 5.14 0.148 11434
    event 50 phone free base 16.7 / 16.7 33.4 / 33.4 50.2 666.6 5.63 0.282 563
    event 50 phone free cand 16.7 / 16.7 33.4 / 33.4 49.1 695.6 4.92 0.241 667
    event 200 desktop broadcast base 66.5 / 99.9 150 / 166.6 13.1 945.7 24.59 0.251 48889
    event 200 desktop broadcast cand 83.4 / 83.4 183.4 / 150 11.7 951.1 33.31 0.305 52905
    event 200 desktop free base 66.8 / 66.8 116.8 / 133.4 12.6 958.9 34.84 0.409 55592
    event 200 desktop free cand 66.7 / 66.7 116.7 / 133.3 13.6 1055.8 30.45 0.380 49831
    event 200 phone broadcast base 50 / 66.7 133.4 / 133.3 15.6 976.6 17.08 0.239 43341
    event 200 phone broadcast cand 66.7 / 66.6 150 / 150 13.9 1019.5 17.62 0.217 45294
    event 200 phone free base 50.1 / 50.1 83.4 / 100 16.5 879.0 25.40 0.412 43371
    event 200 phone free cand 50 / 50 133.3 / 100 18.0 974.2 18.37 0.316 32664
    uniform 50 desktop broadcast base 16.8 / 16.7 50 / 50 38.5 605.7 5.25 0.202 4005
    uniform 50 desktop broadcast cand 16.7 / 16.7 50.1 / 50.1 37.7 546.6 3.83 0.144 11273
    uniform 50 desktop free base 16.7 / 16.7 33.4 / 49.9 49.2 614.8 4.99 0.245 1707
    uniform 50 desktop free cand 16.7 / 16.7 33.3 / 33.3 54.3 741.8 3.65 0.198 456
    uniform 50 phone broadcast base 16.7 / 33.3 49.9 / 66.6 39.1 666.1 4.88 0.189 7213
    uniform 50 phone broadcast cand 16.7 / 33.3 33.4 / 50 41.2 692.2 3.19 0.131 4273
    uniform 50 phone free base 16.7 / 16.7 33.3 / 33.2 55.9 657.3 4.40 0.245 417
    uniform 50 phone free cand 16.7 / 16.7 16.8 / 16.8 57.5 669.0 3.01 0.173 357
    uniform 200 desktop broadcast base 83.3 / 83.3 133.3 / 133.4 12.6 1061.0 22.98 0.260 51339
    uniform 200 desktop broadcast cand 66.7 / 66.7 133.3 / 166.7 12.8 1119.9 18.55 0.211 50070
    uniform 200 desktop free base 66.6 / 66.6 83.4 / 100 16.1 1145.3 27.13 0.431 48230
    uniform 200 desktop free cand 50.1 / 66.6 100 / 99.9 17.2 966.8 22.45 0.376 45142
    uniform 200 phone broadcast base 66.6 / 50 133.3 / 83.4 16.5 1049.3 17.68 0.280 39997
    uniform 200 phone broadcast cand 50 / 50.1 100 / 116.7 17.5 951.6 12.75 0.211 34153
    uniform 200 phone free base 50 / 50 100 / 83.3 17.9 961.4 22.68 0.400 29441
    uniform 200 phone free cand 50 / 50 100 / 83.4 18.0 925.9 20.44 0.359 27366
    uniform 500 desktop broadcast base no data
    uniform 500 desktop broadcast cand no data
    uniform 500 desktop free base no data
    uniform 500 desktop free cand no data
    uniform 500 phone broadcast base no data
    uniform 500 phone broadcast cand no data
    uniform 500 phone free base no data
    uniform 500 phone free cand no data

    A1 (Step 0): the base arms' body work per frame, by part, and the Souls on screen (mean of repeats)

    shape Souls tier camera bodies on screen near / mid / far posed show ms sample setFrame pose matrix ms skeleton ms (calls)
    event 50 desktop broadcast 50.0 17.2 10.5 / 5.4 / 1.4 19.1 5.92 0.57 0.30 4.67 0.81 0.49 (50.0)
    event 50 desktop free 50.0 35.7 0.0 / 35.0 / 0.6 20.8 6.26 0.55 0.27 5.08 0.78 0.41 (50.0)
    event 50 phone broadcast 50.0 5.6 4.5 / 0.7 / 0.5 12.3 4.63 0.54 0.28 3.45 1.08 0.45 (50.0)
    event 50 phone free 50.0 10.9 0.0 / 9.4 / 1.6 11.9 4.16 0.52 0.26 3.04 1.03 0.43 (50.0)
    event 200 desktop broadcast 124.6 66.9 11.3 / 39.9 / 15.7 42.7 19.84 1.67 4.90 12.29 2.83 1.91 (124.6)
    event 200 desktop free 184.8 144.6 0.0 / 142.6 / 2.0 77.4 28.11 1.63 3.72 21.80 4.12 2.62 (184.8)
    event 200 phone broadcast 123.9 14.5 5.3 / 7.7 / 1.5 23.8 12.93 1.65 3.74 6.59 2.65 1.50 (123.9)
    event 200 phone free 181.9 74.7 0.0 / 68.0 / 6.7 49.5 18.71 1.57 3.17 13.10 4.14 2.55 (181.9)
    uniform 50 desktop broadcast 50.0 12.4 3.6 / 1.2 / 7.7 10.8 3.89 0.56 0.26 2.70 0.91 0.45 (50.0)
    uniform 50 desktop free 50.0 8.5 0.0 / 7.1 / 1.4 9.1 3.66 0.56 0.26 2.45 0.91 0.42 (50.0)
    uniform 50 phone broadcast 50.0 6.7 0.4 / 0.2 / 6.1 7.5 3.28 0.53 0.25 2.16 1.14 0.45 (50.0)
    uniform 50 phone free 50.0 1.6 0.0 / 0.1 / 1.5 6.5 2.85 0.52 0.23 1.75 1.10 0.45 (50.0)
    uniform 200 desktop broadcast 174.8 63.1 7.2 / 4.3 / 51.5 36.5 16.58 1.63 4.38 9.60 3.74 2.66 (174.8)
    uniform 200 desktop free 190.2 80.4 0.0 / 79.8 / 0.5 53.9 19.91 1.65 2.53 14.86 4.20 3.01 (190.2)
    uniform 200 phone broadcast 145.2 31.8 2.7 / 0.1 / 29.0 24.4 12.34 1.59 3.25 6.64 3.34 2.00 (145.2)
    uniform 200 phone free 177.7 60.7 0.0 / 49.3 / 11.5 42.3 16.76 1.55 2.95 11.39 3.60 2.32 (177.7)

    The candidate arms: held and posed per frame

    shape Souls tier camera on screen posed held matrix ms skeleton ms (calls)
    event 50 desktop broadcast 19.9 18.3 25.1 0.52 0.26 (24.9)
    event 50 desktop free 30.3 18.9 16.5 0.58 0.24 (33.5)
    event 50 phone broadcast 13.5 11.9 30.6 0.47 0.17 (19.4)
    event 50 phone free 22.7 11.2 23.0 0.58 0.22 (27.0)
    event 200 desktop broadcast 75.5 74.8 63.4 2.09 1.20 (84.8)
    event 200 desktop free 113.0 61.0 28.6 2.87 1.58 (117.2)
    event 200 phone broadcast 31.1 30.7 101.2 1.13 0.58 (46.6)
    event 200 phone free 57.5 37.8 70.1 1.74 0.92 (67.8)
    uniform 50 desktop broadcast 12.4 8.5 32.9 0.38 0.17 (17.1)
    uniform 50 desktop free 9.6 9.3 35.3 0.26 0.10 (14.7)
    uniform 50 phone broadcast 2.7 7.0 41.4 0.23 0.06 (8.7)
    uniform 50 phone free 2.2 6.8 41.8 0.24 0.06 (8.2)
    uniform 200 desktop broadcast 34.1 34.7 120.4 1.44 0.71 (51.5)
    uniform 200 desktop free 84.0 50.7 61.0 2.21 1.22 (92.7)
    uniform 200 phone broadcast 2.2 22.8 151.0 0.68 0.26 (24.0)
    uniform 200 phone free 77.6 47.4 84.5 2.03 1.19 (89.8)

    Host: renderer, cores and load per arm are in each results.json (gl, cores, rows[].host) and timed-run.json (cpuSplit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

agent:claimedAn agent or person has claimed this issue; others leave it aloneagent:readyTriaged and specified well enough for an agent to pick up

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions