Repository navigation
Speed up dense vegetation and prevent million-instance traversal overflow - #86
Merged
Merged
Conversation
SamG-Coder
changed the base branch from
codex/performance-history-fixes
to
main
November 13, 2026 10:16
SamG-Coder
marked this pull request as ready for review
November 13, 2026 10:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dense forests waste raster work on pixel centres outside tiny triangles and can overflow the traversal queue with nodes that the next dispatch immediately rejects for LOD. Reject those children before enqueueing and bound raster loops using the existing fixed-point vertices, preserving the detail threshold and coverage rules.
This PR is stacked on #85. Its base is
codex/performance-history-fixesso the diff contains only the vegetation follow-up.Also defer unused particle-pool buffers until the first effect is prepared (27.58 MiB at the default capacity), and reuse the sky-view table when its exact shader parameters are unchanged. Add a reproducible procedural grass/tree benchmark, sequential comparison runner, per-pass measurements, image checks, and GPU regressions.
Results
RTX 5080 / Ryzen 7 9800X3D, native Vulkan, 1920×1080, unchanged default quality. Medians over two 240-frame runs per version:
All 1,440 paired frame positions have identical selected cluster and triangle counts. The million-patch / 65,536-tree scene now renders 1,179,649 instances with zero measured drops: 6.043 ms GPU in overview and 6.620 ms at ground level. Before early LOD rejection, the overview dropped more than ten million queue entries. Its shorter incomplete render is excluded from speed comparisons.
CPU medians changed little and exploratory variability prevents claiming a reliable CPU speedup. The memory saving is GPU buffer allocation; whole-process RAM did not show a consistent decrease. Whole shaded images are not bit-identical; measured differences and baseline-repeat variation are reported.
Validation
Detailed audit and measurements. These are shared-renderer native tests, not browser FPS or a rebuild of the reported street application.
Authorship
Reviewed by: Claude Sonnet 5.5 (independent review, no correctness bugs found: early LOD rejection uses the consumer's exact predicate, the software-raster bounds keep every covered sample centre including ties, the lazy particle pool is always allocated before use, and the sky-view cache key covers every input). Noted, not blocking: the LOD predicate is duplicated rather than shared; the particle pool is now allocated when the first effect starts, which may cost a one-off frame; the new dev-dependencies (
solstice-procgen,png, already in the lockfile) stay out of the browser build. Locally verified by Claude Opus 5.5 at 2918919 on top of #85:bash scripts/check-changed.sh --all(1012 passed, 0 failed, all checks passed, including the full GPU integration suite) andnode apps/viewer/web/editor/test.mjs(all passed). Retargeted to main after #85 merged.