Skip to content

Performance: move parsing to Web Worker for large bursts #20

@takker99

Description

@takker99

Priority: P3
Category: Performance

Background:
Parsing currently runs on main thread; heavy bursts (thousands of frames) could block UI if extended. A Web Worker can offload CRC + frame assembly.

Goal:
Introduce optional worker-based parser path toggled automatically when buffered bytes exceed threshold.

Acceptance Criteria:

  • Worker file implementing parse loop, posting parsed frames + errors back
  • Main thread fallback if worker unsupported
  • Benchmark: 10k small frames processed with <50% main thread blocking vs baseline
  • Tests (integration) simulate worker messages (mock or real) ensuring identical outputs

Tasks:

  1. Prototype worker (TypeScript) build via Vite
  2. Define message protocol (input bytes chunk, flush, result)
  3. Refactor ModbusClient to optionally delegate
  4. Benchmark script (manual) results documented in issue comments
  5. Minimal test verifying delegation logic

Definition of Done:
Worker path functional, tests green, documented trade-offs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions