perf: reuse core Link dependency metadata in React and add focused client-nav benchmarks#6999
perf: reuse core Link dependency metadata in React and add focused client-nav benchmarks#6999
Conversation
Teach router-core to expose internal Link dependency metadata so React can reuse cached next locations during search-only churn. Add a focused benchmark and investigation notes so the targeted win can be measured against main.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx affected --targets=test:eslint,test:unit,tes... |
❌ Failed | 15m 11s | View ↗ |
nx run-many --target=build --exclude=examples/*... |
✅ Succeeded | 1m 52s | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-03-22 17:23:02 UTC
🚀 Changeset Version PreviewNo changeset entries found. Merging this PR will not cause a version bump for any packages. |
Bundle Size Benchmarks
Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better. |
Merging this PR will degrade performance by 42.51%
Performance Changes
Comparing |
Track only the current search keys and key-count information that active-state matching actually needs, so static search links can skip rerenders even with includeSearch enabled. Simplify buildLocation dependency collection and extend the React client-nav benchmark to measure both includeSearch modes.

Summary
Linkreuse core-generated location dependency metadata so it can skip unnecessarybuildLocationwork and avoid rebuilds on unrelated location updates.link-performance-investigation.mdcovering the explored approaches, tradeoffs, correctness fix, and current understanding.Benchmarks
main(-2.2%throughput in the measured run), so the broad benchmark does not yet show a general win.activeOptions={{ includeSearch: false }}(+65.2%throughput,-39.5%mean time).activeOptions={{ includeSearch: true }}(+5.8%throughput,-5.4%mean time), showing that reusing cachednextstill helps even when active-state recomputation remains necessary.Validation