Skip to content

fix(wasm,renderer): offset iteration budget by SA skip and floor slice height - #97

Merged
rowan-m merged 2 commits into
mainfrom
fix/sa-offset-iteration-budget
Sep 28, 2026
Merged

rowan-m merged 2 commits into
mainfrom
fix/sa-offset-iteration-budget

Conversation

@rowan-m

@rowan-m rowan-m commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

  1. Offset calc_iter by Series Approximation skip_iter (wasm/src/lib.rs):

    • At deep views inside narrow valleys/clovers (e.g. z = 16.681, skip_iter = 21,311), up to 80% of the initial search_limit (27,018) is consumed by the shared pre-rebase prefix before orbits in the viewport even begin to diverge from one another.
    • Because search_anchor stops as soon as the centre candidate reaches search_limit, Phase 2 of the anchor search was skipped and calc_iter capped out at 40,527 — leaving only ~19k post-skip iterations and clipping the central 4-lobed clover (41k–107k iterations) to solid black.
    • Offset calc_iter by skip_iter, advance the reference orbit through that post-skip budget, and when an anchor that survived search_limit subsequently escapes during the + skip_iter extension, scale calc_iter to at least orbit.n + 3 * skip_iter.
    • Shallow views (skip_iter == 0) and periodic bulb interiors (!orbit.escaped) are unaffected.
  2. Floor progressive slice height at a 32-row hardware tile strip (src/Renderer.js):

    • When effectiveIter is large (86,197 post-skip iterations at z = 16.681), a single GPU thread's sequential loop latency (~50–67 ms) exceeds TARGET_SLICE_MS (32 ms).
    • Without a minimum slice height, nextRows = ceil(prevRows * 32 / elapsedMs) decayed exponentially (52 -> 21 -> 11 -> 6 -> 4 -> 2 -> 1 row), starving the GPU's parallel shader lanes while still paying the full single-thread serial latency and full-screen post-pass blit on every 1-row slice (27.4 s across 411 slices on Pixel 11).
    • Floor _sliceRows at MIN_SLICE_ROWS (32 rows, one 32x32 mobile TBDR hardware tile strip, capped by remaining), cutting the full-resolution 1078x2008 render at iter = 107,508 on the Pixel 11 from 27.4 s (411 slices) to 3.19 s (48 slices, 8.6x faster).

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 0cdc316):

https://fractious-deep--pr97-fix-sa-offset-iterat-hbqm05nd.web.app

(expires Mon, 05 Oct 2026 13:35:07 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 348393a9746312ebab7a45ce5eba16e6d119af34

@rowan-m rowan-m changed the title fix(wasm): offset iteration budget by Series Approximation skip prefix fix(wasm,renderer): offset iteration budget by SA skip and floor slice height Sep 28, 2026
@rowan-m
rowan-m merged commit b56d81f into main Sep 28, 2026
2 checks passed
@rowan-m
rowan-m deleted the fix/sa-offset-iteration-budget branch September 28, 2026 14:10
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