Skip to content

perf(shader): skip main bulbs, detect periodic orbits, and halve orbit loads - #95

Merged
rowan-m merged 2 commits into
mainfrom
perf/skip-interior
Sep 25, 2026
Merged

rowan-m merged 2 commits into
mainfrom
perf/skip-interior

Conversation

@rowan-m

@rowan-m rowan-m commented Sep 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Analytic main-cardioid & period-2 bulb check (in_main_bulbs): At shallow zooms (zoom > 1e-3, where f32 resolves $c = X_1 + \Delta c$ well below a pixel), skip pixels inside the main cardioid and period-2 bulb before entering the iteration loop.
  • Brent periodicity detection in fs_main_f32: At shallow zooms (zoom > 1e-3), detect periodic interior orbits (such as period-3/4 bulbs and shallow minibrots) when $Z_n$ returns within zoom * 1e-5 of a saved checkpoint.
  • Single reference_orbit load per iteration: Carry $X_{m+1}$ forward as the next iteration's $X_m$ (resetting to $X_0 = 0$ on rebase) across all three shader tiers (fs_main_f32, fs_main_ds, fs_main_qs), halving storage-buffer reads per step.

Pixel 11 Benchmark (1078×2008 canvas, fractious:full-res)

View main This PR Speedup
Seahorse Valley + main bulb (x=-0.768..., y=0.212..., z=0.936, r=2.7) 10,945 ms (653 slices) 401 ms (11 slices) ~27×
Default view (x=-1.7, y=0, z=-0.301, iter=7500) ~10,000 ms 268 ms (14 slices) ~37×
Whole Mandelbrot set (x=-0.5, y=0, z=-0.301, iter=7500) 6,766 ms 189 ms (10 slices) ~36×

@github-actions

github-actions Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

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

https://fractious-deep--pr95-perf-skip-interior-97o5b9ly.web.app

(expires Fri, 02 Oct 2026 13:05:50 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 348393a9746312ebab7a45ce5eba16e6d119af34

@rowan-m
rowan-m merged commit 48ae798 into main Sep 25, 2026
2 checks passed
@rowan-m
rowan-m deleted the perf/skip-interior branch September 25, 2026 13:24
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