Skip to content

Navigation Menu

Sign in
Sign up

perf(watcher): reuse live root map for dispatch - #10

Open
srinivasdrona wants to merge 1 commit into
superbasedapp:main from
srinivasdrona:watcher-optimization
Open

perf(watcher): reuse live root map for dispatch #10
srinivasdrona wants to merge 1 commit into
superbasedapp:main from
srinivasdrona:watcher-optimization

Conversation

@srinivasdrona

@srinivasdrona srinivasdrona commented Sep 1, 2026

Copy link
Copy Markdown

Summary

  • reuse the live watcher root index during file dispatch instead of rebuilding the root-to-adapter map from the registry on every poll/write re-dispatch
  • reduces steady-state CPU in the watcher hot path during high-churn session file activity
  • adds regression coverage for live-root dispatch

Benchmark

Measured on the same hot path (Watcher.adapterFor()):

  • before: ~13.8 μs/op
  • after: ~3.0 μs/op
  • ~78% faster (~4.5x speedup)

Validation

  • go test ./internal/watcher

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0169310b-2e4b-4157-8609-490962d6de95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /