[Fractal-gh] Render off the main thread (Web Worker/progressive) to stop UI freezes
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- frontend, performance
Research direction
Start with Mandlebrot/Fractal-gh/app/fractal.js:213-242 and Mandlebrot/Fractal-gh/app/app.js:246-279; the issue reports a synchronous pixel loop and timeout workarounds. First compare the current renderer's output and responsiveness against the supplied 2880x1800@1792 benchmark. Done means rendering stays responsive, rapid clicks cancel stale renders, and the default view remains pixel-identical; the proposed worker, progressive rendering, and optional WebGL paths make this substantial design work.
Written by the indexing model from the issue text.
Description
Summary
drawToImageData computes every pixel synchronously on the main thread. On a retina-size canvas the page freezes for seconds, which is why app.js needs several setTimeout "hack workarounds" to show the loading overlay and swallow clicks.
Location
Mandlebrot/Fractal-gh/app/fractal.js:213-242Mandlebrot/Fractal-gh/app/app.js:246-279(timeout workarounds)
Evidence
Headless Chromium, new Fractal(canvas).update({pxWidth:2880, pxHeight:1800, maxEscapeTime:m}):
"2880x1800@224": "705 ms (main thread blocked)"
"2880x1800@1792": "3810 ms (main thread blocked)"
(Replacing the Math.sqrt escape test with x*x+y*y < 4 changed 3810 ms to 3756 ms, so the cost is the blocking loop, not sqrt.)
Expected
The UI stays responsive during rendering and a render can be cancelled when the user clicks again.
Proposed fix
- Move
calcEscapeTime/rgbNuminto a Web Worker that renders row bands into transferableImageDatabuffers; split acrossnavigator.hardwareConcurrencyworkers. - Show progressive results (coarse pass, then refine) and cancel stale jobs on new input.
- Remove the
setTimeoutworkarounds once rendering is asynchronous. - Optional: a WebGL fragment-shader path for instant redraws at low iteration counts.
Acceptance criteria
- Main thread never blocks for more than 50 ms during a 2880x1800@1792 render
- Rapid successive clicks render only the final view
- Output is pixel-identical to the current renderer for the default view
Repository audit, November 2026 · Phase 9 · New features · evidence: reproduced · ref fractals-equations-006
Generated by Claude Code
- Dominant language
- C++
- Stars
- 2
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ibra-kdbra/Math-Problems
-
area: security-algorithms priority: P1 size: XS type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
ibra-kdbra/Math-Problems#417 ·
-
area: math-chaos priority: P3 size: S type: enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
ibra-kdbra/Math-Problems#397 ·
-
area: docs-site good first issue priority: P3 size: XS type: chore
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ibra-kdbra/Math-Problems#379 ·
-
area: docs-site good first issue priority: P3 size: XS type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
ibra-kdbra/Math-Problems#378 ·
-
area: docs-site good first issue priority: P2 size: XS type: chore
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ibra-kdbra/Math-Problems#367 ·
All issues in ibra-kdbra/Math-Problems
Similar issues
-
TransformInteract: a circle drag through the centre sets Scale to its minimum, which can't grow backOpendifficulty:easy prio:low type:bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NatronGitHub/openfx-supportext#311 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
CachyOS/packageinstaller#211 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
OpenEmu-Silicon/OpenEmu-Silicon#920 · 1 comment ·
Maintainers usually reply within 1 day
-
Good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 65/100