Skip to content

Introduce web worker to resolve the UI freezing issue during simulation #577

Description

@boulderdaze

The UI lags and becomes unresponsive for the full duration of a simulation when the configuration contains a large number of mechanisms.
The solver runs as a WASM module synchronously on the main thread, which blocks the UI while the simulation is executing.

Move the solver execution to a module Web Worker.
The WASM module is loaded via dynamic import, which works inside a module worker. Vite 7 also supports new Worker(new URL(...), { type: 'module' }) natively.

The mechanism configuration and solver results are plain JSON-serializable objects, so the structured-clone overhead of communicating between the main thread and worker should be relatively small.

Activity

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

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions