Skip to content

perf: optimize Tile runtime and startup, fix frame diagnostics - #21

Draft
ZyFou wants to merge 3 commits into
mainfrom
perf/audit-preserve-visuals
Draft

perf: optimize Tile runtime and startup, fix frame diagnostics#21
ZyFou wants to merge 3 commits into
mainfrom
perf/audit-preserve-visuals

Conversation

@ZyFou

@ZyFou ZyFou commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Based on the supplied performance audit of 1b488d99aae81fae615eecf281fb24e2f9995cdf, with a follow-up for the reported ground-approach freeze, low Tile performance in worker mode, and inconsistent FPS counters.

The screenshot showed 60 FPS / 1 draw / 1 triangle in the overlay versus 39 FPS / 104 draws / 56K triangles in the status bar. The overlay sampled animation callbacks and the final fullscreen pass. Worker input also failed to reset the activity timer, allowing idle pacing during navigation. Near-water preparation compiled unrelated hidden scene materials and detached clouds while waiting.

Changes:

  • Reset activity on forwarded worker input and continued main-thread dragging. Camera settling also bypasses idle pacing; passive hovering still permits it.
  • Share elapsed-time-normalized scene FPS and scene draw/triangle counts between the HUD and profiler. Exclude skipped callbacks from CPU frame timing and retain long stalls in average FPS.
  • Prepare only the underwater fullscreen composite, with one pending job and stale-result rejection. Prepare it under the boot cover when water is enabled; retain a small-pass fallback for later enabling/resizing. Scene edits no longer trigger unrelated underwater scene compilation or cloud detachment.
  • Avoid zero-contribution procedural detail and unused planar texture projections, retaining fade/debug behavior, UV salts and normal math. Pack the same rasterized prop surface height before unused fragment terrain calculations.
  • Build reflection revision keys only for an eligible Cinematic reflection pass.
  • Overlap initial cloud readiness, terrain/water compilation and incremental geometry; preserve readiness gates and renderer target/cube-face/mip restoration.
  • Use asynchronous, coalesced minimap readback and bounded analytical sampling, with reusable buffers, stale-result rejection, safe worker transfers and cached unchanged maps.
  • Reuse Tile centre climate, shade ordinary plinth walls earlier, defer the drawer chunk, release inactive post/cloud targets and expand resource/comparison diagnostics.

Validation:

  • 632 tests passed across 74 files; production build passed. Existing Vite large-chunk warnings remain.
  • New regressions cover worker zoom/long drags, skipped callbacks versus actual frames, post-pass counter replacement, long stalls, cloneable diagnostics, boot composite readiness, repeated approach requests and resize/disposal/program changes during compilation.
  • Reflection revision caching is covered for both eager and lazy keys, including inactive modes.
  • The earlier CPU minimap run produced 18 RGBA images matching the audit baseline byte for byte. Median height-map generation changed from 435.4 ms blocking to 156.3 ms total including yields; the largest observed sampling batch for that mode was 6.6 ms. These are CPU-only minimap results, not GPU/FPS measurements or validation of the new shader fast paths.
  • Published tree matches the tested local tree: 166dd5c67ff3ed4d9e47e01febcb8ea4bfb679f7.

Implementation notes, measurements and reproduction commands are in docs/performance/audit-implementation.md.

Draft pending full 3D/device validation. Local browser access was blocked with net::ERR_BLOCKED_BY_CLIENT, so the reported freeze has not been reproduced on the user's GPU and full visual parity/runtime gains are not yet measured. Recheck ground approach, shoreline crossings, detailed/textured slopes, planar/triplanar surfaces, prop placement and both counters at identical settings. The supplied 18,064 ms terrain compile trace establishes a startup bottleneck; it does not establish that the later freeze was texture generation.

Requested resolution, noise octaves, cloud steps, water quality, textures, props and LOD settings are preserved. The sampled Tile field cache remains disabled. Resource counts remain advisory estimates.

@ZyFou ZyFou changed the title perf: optimize startup, minimaps and GPU resource lifetime perf: optimize Tile runtime and startup, fix frame diagnostics Sep 8, 2026
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