perf(viewer): hand the entity index to the parser the moment it exists
Draft
LO
13d ago+39+39+01234567890123456789-5-5-0123456789
On cold loads of files of 32 MB and up, the viewer held the geometry pre-pass's entity index back from the parser worker until a geometry worker had finished, the stream completed, or 8 ms per MB had passed. This change hands the index over as soon as it exists, at every size.
Why now
The hold was added in #3921 to give geometry a head start and to keep parser allocations from overlapping the geometry pool's peak. Since the cold-finalize work (#9684, #9747), the hold no longer makes metadata wait off to the side. It pushes metadata into the renderer finalize. Timed figures come from the scoreboard, main+#9684+#9747 (000532b2cc), 5 rounds, exclusive admission:
- Holter: the index exists at about 0.59 s but is released by the deadline at about 1.65 s; the parser waits 1,070 ms (timed span).
- Finalize:
scene.finalizetakes 195ā245 ms when metadata stays out of it. It takes 518ā680 ms in every round whereparser.completeand the store commit land inside it (Holter 1 of 5 rounds, BWK 3 of 5).
Change
coldEntityIndexHandoffPolicy()inentityIndexHandoff.tsmakes the policy explicit and testable: no deferral at any size.useIfcLoaderuses it.forwardEntityIndexTokeeps its deferral mode, now unused by the loader.- New test: at 0.5ā1,050 MB the index reaches the parser sink at once, and a later
release()does not deliver it twice.
Not yet verified (in progress)
- Timed A/B on top of #9684 + #9747: Holter, BWK (#3921's architecture model), advanced_model and FZK; cold plus both reopens; 5 rounds; peak memory. A memory regression beyond the noise floor fails the change. This PR stays
unqueueduntil that verdict and the data-store identity check (entities, all edges, on-demand maps, every property and quantity result, spatial hierarchy) on all seven scoreboard fixtures are in. - The focused viewer tests run through the fleet. Locally,
entityIndexHandoff.test.tspasses 14/14.
š¤ Generated with Claude Code