Repository navigation
perf(wasm): Create image decode workers on demand (backport #25132) - #25898
Merged
agneszitte merged 1 commit intoNov 1, 2026
Merged
Conversation
ImageLoader created one worker per logical processor at startup, each an isolate with its own heap and canvas: about 4 MB apiece, so 130 MB on a 32-thread machine before any image was decoded. Workers are now created when a decode finds none idle, up to the same limit, so burst decoding is unchanged. Fixes #25125 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> (cherry picked from commit e768182)
1 of 5 tasks
agneszitte
approved these changes
Nov 1, 2026
Contributor
|
🤖 Your WebAssembly Sample App stage site is ready! Visit it here: |
This was referenced Nov 9, 2026
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.
GitHub Issue: closes #25125
PR Type:
🐞 Bugfix (performance)
What changed? 🚀
Uno.UI.Runtime.ImageLoadercreated one decode worker per logical processor when the script loaded, whether or not the app ever decoded an image. Each worker is a separate isolate with its own heap and anOffscreenCanvas2D context.Workers are now created on demand. A decode uses an idle worker if there is one. Otherwise it creates a worker while fewer than
navigator.hardwareConcurrencyexist, and otherwise it waits in the existing queue. The limit is unchanged, so burst decoding keeps the same parallelism.Measurements 📊
Master's SamplesApp on WASM in headless Edge, on a 12-thread machine.
navigator.hardwareConcurrencywas set through the DevTools protocol (Emulation.setHardwareConcurrencyOverride) before load, which sets the pool size without changing code. Memory is Windows private bytes of the tab's renderer process; the GPU process doesn't change with worker count. Two runs per row.Idle cost, before this PR: about 4 MB per worker.
hardwareConcurrencyAfter the change, one worker exists at idle because the SamplesApp decodes an image at startup. An app that never decodes one creates none.
After a burst of 48 decodes of a 2048×2048 PNG, 15 s later:
Decode time for the same burst is unchanged:
Validation
Given_BitmapSource, in headless Edge: 16/16 pass, 1 skipped (an existing[Ignore]). This includesWhen_Browser_Workers_Are_Reused, which sends one more concurrent decode thanhardwareConcurrencyand so exercises growing the pool to its limit and reusing a worker.PR Checklist ✅
Screenshots Compare Test Runresults.🤖 Generated with Claude Code
This is an automatic backport of pull request #25132 done by [Mergify](https://mergify.com).