Skip to content

[WASM] The image decode worker pool creates one worker per logical processor, a fixed memory cost that scales with core count #25125

Closed

Description

@mikernet

Current behavior

Uno.UI.Runtime.Skia.ImageLoader (src/Uno.UI.Runtime.Skia.WebAssembly.Browser/ts/Runtime/ImageLoader.ts) creates its decode workers eagerly:

static availableWorkers: Worker[] = Array.from({ length: navigator.hardwareConcurrency }).map(...)

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)
  • net10.0-browserwasm, Chromium

Activity

  1. self-assigned this
    on Oct 8, 2026
  2. added a commit that references this issue on Oct 9, 2026
    e768182
  3. added a commit that references this issue on Nov 2, 2026
    80ae054
  4. added a commit that references this issue on Nov 3, 2026
    1275c15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions