Files
VoxelForge/Standalone/Research/WorldAssemblerM3/Research28/first-pass.md
T

9.5 KiB
Raw Blame History

VoxelForge R28 — fixed cost across generators

Read-only review. I made no source changes and ran no scripts, tests, builds, or binaries.

Cost decomposition

One comparability issue changes the interpretation: the saved whole-view logs do not show the same 2,370-tile view for every recipe. The L55 SurfaceWorld trace has 2,370 tiles. The flatField profile trace has 2,226 tiles at LOD0–8; the caves and lattice traces have 729 tiles at LOD0 only; and the motif trace has 343 tiles at LOD0 only. The per-generator totals below are useful, but the motif-versus-profile totals are not a matched-view comparison. (L55 timeline, flatField log, caves log, motif log, lattice log)

The table’s LOD and per-tile figures are summed worker time, not wall time. “Worker ms/tile” includes field and mesh work; the logs do not isolate pure per-tile dispatch overhead. Don’t add worker seconds directly to shape seconds.

Generator Whole view Shape setup LOD0–1 worker time LOD4–8 worker time All-LOD worker ms/tile
Natural SW 1.78 s 0.40–0.46 s 3.473 s / 960 tiles 7.878 s / 882 tiles 5.62
flatField profile 1.33 s 0.432 s 3.757 s / 960 4.676 s / 738 4.66
Caves 0.73 s 0.060 s 5.774 s / 729, LOD0 only Not measured 7.92
Motifs 0.52 s 0.045 s 4.889 s / 343, LOD0 only Not measured 14.25
Lattice 1.69 s 0.137 s 17.255 s / 729, LOD0 only Not measured 23.67
FI 5.03 s 0.445 s diagnostic 32.535 s / 960 13.651 s / 882 21.17

Whole-view values are from the supplied facts and the round reports. The per-LOD traces show why they cannot all be decomposed on the same basis: L55 has the all-LOD SW and FI trace; L53 has the flatField breakdown; the other three speed logs use max_clip_level=0. FI’s worker sums are from the L55 static trace, before the later L57 Z-inner traversal change. (L53 report, L54 report, L55 report, L56 report, L58 report)

In the full SW trace, LOD4–8 account for 7.878 worker seconds, versus 3.473 seconds at LOD0–1. The LOD0 tiles alone scan 16.78 million candidate cells; the trace records no proof-skipped air or solid cells. Across the queued run, workers were idle with work waiting for only 9.957 ms. That points to grid and mesh work, including skirts and far-LOD work, rather than scheduler idle time. (L55 report, SW trace)

What’s shared is the view’s tile set, task submission, and meshing machinery for tiles that still need geometry. Shape setup is not a universal 0.4-second floor: it ranges from about 45 ms for the logged motif run to 432 ms for flatField, and far-parent setup is conditional. Nor does every recipe pay for LOD4–8 in the cited runs. The ShapeStage log separates local shapes, intervals/signs, surface band, and far parents; the tile stages expose grid, connectors, ground/cap, skirts, and assembly work. (shape-stage code, far-parent code)

Why Motifs is 0.52 s and flatField is 1.33 s

The logged runs explain much of the difference without proving a 2.5× code-path penalty. Motifs ran with max_clip_level=0: 343 LOD0 tiles, a 45 ms shape stage, and no far-parent stage. flatField ran through LOD8: 2,226 tiles and a 432 ms shape stage, including 243 ms for the surface band and 68 ms for far parents. The shape-stage gap is 387 ms; the remaining whole-view difference is confounded by the much larger tile set and extra LODs.

Motifs is also not a separate caves-style primitive terrain path. Its fixture is a SurfaceWorld stratum with two sparse SDF motif fills. The base SurfaceWorld field uses Heightfield2D; the motif records add bounded primitive shapes. Caves instead binds an FCavesFieldAdapter over host rock and composes cave features into it. (motif log, field adapters, SurfaceWorld dispatch)

FlatField does skip the profile cosine work and assigns constant ground and cap heights. But each point still goes through the heightfield column path and computes signed distance to the ground and cap; the tile mesher still builds the requested surfaces and LOD geometry. (flat profile evaluation, heightfield point evaluation)

Recommendation

Reuse proofs and far-LOD handling; don’t move the whole heightfield family onto the caves primitive path. The two paths have different contracts. A wholesale move would need to reproduce SurfaceWorld profiles, biome and feature behavior, water samples, cap handling, route composition, and cross-LOD continuity. It would add a second implementation without evidence that it removes the dominant meshing cost.

A ranked plan:

  1. Wire conservative classification into runtime tile work. Heightfield interval and lattice classifiers already exist, and caves demonstrably skips 638 of 729 tiles in its logged run. The SW trace, by contrast, records zero air/solid proof skips. First verify why that proof is not reducing SW’s cell work; then use certified all-air/all-solid boxes to avoid density sampling and meshing where safe. This is the best shared opportunity for profiles, natural SW, caves, and lattice. (heightfield classifier, API proof contract, caves timing)

  2. Optimize SurfaceWorld’s far LODs and LOD0–1 together. SW’s LOD4–8 work is 7.878 worker seconds, but L55’s estimate says reaching 1 s requires cutting about 6.164 worker seconds overall. Removing LOD0 or LOD6–8 alone cannot meet that target. Reuse cached ground/cap columns and simplify far-surface generation only where interval proofs preserve the ground, cap, connectors, and seams.

  3. Add a heightfield-specific fast path for simple profiles. FlatField already avoids noise evaluation, yet still pays general 3D density and meshing costs. A direct ground/cap path could target the additional 0.33 s needed for profiles to reach 1 s. Extending it to natural SW could yield more, but has higher risk because feature composition and terrain variation must remain correct.

  4. Tune primitive LOD0 work per recipe. The logged lattice run has 17.255 worker seconds on 729 LOD0 tiles; reaching 1 s from its reported 1.69 s needs a large reduction. Keep caves as a regression guard: its reported 0.73 s is already under target. Motifs also reports under 1 s, but its 343-tile LOD0 run does not establish full-view performance.

  5. Deprioritize scheduler changes. The full-view SW trace has only 9.957 ms of worker-idle time while queued work remains. A large scheduling gain is unlikely without new evidence.

For each performance claim, first rerun all recipes with identical tile keys, LOD range, hash flags, compiler, and worker count. Record whole-view wall time, shape stages, per-LOD worker sums, cell/proof counts, and connector/ground/cap/skirt time. For candidate changes, compare interleaved runs and check output hashes, route support, and LOD seams. Lattice needs particular focus: its logged LOD0 run is 1.69 s despite using 729 tiles.

Conservative cell classification is an established isosurface optimization technique, but published speedups are dataset-specific and are not a forecast for VoxelForge. Buatois and Caumon, “Cells classification data structures for faster isosurface extraction”

Still unknown

The saved logs do not substantiate the claimed common 2,370-tile benchmark; a matched full-view run is needed to settle the motif/profile comparison. They also do not provide the same stage-level timing for every recipe. In particular, the true per-tile dispatch cost and the full-view primitive-path costs for caves, motifs, and lattice remain unisolated.