Skip to content

perf(adapters): idle sources emit updates for every mousemove and scroll #378

Description

@vamgan

Summary

Idle-source adapters perform reactive state updates and notifyChanged() calls for every configured activity event, including high-frequency mousemove and scroll events.

Equivalent behavior exists across React, Vue, Svelte, Solid, and Angular. With subscribers or the inspector enabled, normal pointer movement can cause dozens or hundreds of source resolutions/serializations per second.

Proposed fix

  • Update a mutable last-activity timestamp cheaply for raw activity events.
  • Emit/reactively render only on meaningful active → idle and idle → active transitions, or on a bounded cadence.
  • Replace the permanent five-second interval with a timeout scheduled for the idle deadline.
  • Optionally expose elapsed-time updates at no more than 1 Hz.

Acceptance criteria

  • 1,000 mousemove events produce bounded source-change emissions
  • Idle and wake transitions occur at correct times under fake timers
  • All adapters follow the same emission contract
  • No persistent interval is required while activity is known
  • Inspector/subscriber behavior is covered by a benchmark

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions