Skip to content

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

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

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

Conversation

@srinivasdrona

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants