You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[WASM] The image decode worker pool creates one worker per logical processor, a fixed memory cost that scales with core count #25125
Each worker is a separate JavaScript isolate with its own heap, plus an OffscreenCanvas and 2D context, created at startup whether or not the app ever decodes an image. On a 16-thread desktop that is 16 isolates; on a 32-thread workstation, 32. The baseline cost sits outside both the wasm linear memory and the main JavaScript heap, so it shows up only in the browser's per-tab memory, where it reads as a few hundred megabytes of unexplained footprint on many-core machines (measured here: tab at 1.2 GB with wasm at 661 MB and the main JS heap at 35 MB).
Decoding is also not where that parallelism is spent: a page rarely has more than a handful of images in flight, and each worker's output is a single transferred pixel buffer handed to the main thread, which copies it into wasm memory serially.
Expected behavior
A small fixed cap (for example Math.min(navigator.hardwareConcurrency, 4)), or workers created lazily on first use and released after an idle period, so the baseline does not scale with the machine's core count. The existing job queue already handles more requests than workers.
Environment
Uno.WinUI 6.8.0-dev.212 and master (ImageLoader.ts is the same on both)
Activity
perf(wasm): Create image decode workers on demand
perf(wasm): Create image decode workers on demand (port)
perf(wasm): Create image decode workers on demand
perf(wasm): Create image decode workers on demand