perf(react): optimize git tree materialization for diff#109
Conversation
Replace per-file git cat-file with git archive|tar pipeline, add CoW clone strategy for the second snapshot, and use async cleanup via detached rm processes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Review Summary by QodoOptimize git tree materialization for diff analysis with CoW cloning
WalkthroughsDescription• Replace per-file git cat-file with git archive | tar pipeline for ~60x faster snapshot materialization • Add copy-on-write clone strategy to materialize after tree once, then overlay only changed files • Use async fire-and-forget rm -rf via detached child processes instead of blocking cleanup • Consolidate graph loading logic into unified loadBothGraphs function with optimized snapshot handling Diagramflowchart LR
A["Git Trees<br/>beforeTree, afterTree"] -->|"git archive<br/>pipeline"| B["Materialize<br/>afterSnap"]
B -->|"CoW clone<br/>cp -c/-a"| C["Clone to<br/>beforeSnap"]
A -->|"git diff<br/>--name-status"| D["Identify<br/>Changed Files"]
D -->|"Overlay<br/>modifications"| C
C -->|"Analyze"| E["React Graphs"]
B -->|"Analyze"| E
E -->|"async rm -rf<br/>detached"| F["Cleanup<br/>Snapshots"]
File Changes1. src/analyzers/react/diff.ts
|
Code Review by Qodo
1.
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #109 +/- ##
==========================================
- Coverage 66.08% 65.97% -0.11%
==========================================
Files 39 39
Lines 2586 2613 +27
Branches 857 862 +5
==========================================
+ Hits 1709 1724 +15
- Misses 520 526 +6
- Partials 357 363 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Merging this PR will improve performance by 59.35%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | full component and hook diff |
25.8 ms | 16.2 ms | +59.35% |
| ⚡ | component-only diff |
26.6 ms | 16.9 ms | +57.43% |
Comparing async3619/debug-slow-dev (f1b39a7) with dev (4ae9e65)
## [1.2.0-dev.1](v1.1.1-dev.1...v1.2.0-dev.1) (2026-03-28) ### Features * **react:** add usage diff and benchmark coverage ([#107](#107)) ([4ae9e65](4ae9e65)) ### Bug Fixes * **react:** resolve builtin elements from namespace-imported styled-components ([#110](#110)) ([2a76067](2a76067)) ### Performance * **react:** optimize git tree materialization for diff ([#109](#109)) ([b38bf71](b38bf71))
|
🎉 This PR is included in version 1.2.0-dev.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary
git cat-filewith a singlegit archive --format=tar | tar -xpipeline for snapshot materialization (~60x faster for large repos)cp -cclone it and overlay only changed files for the before treerm -rfvia detached child processes instead of blockingfs.rmSyncfor snapshot cleanupRelated Issue
Closes #
Validation
pnpm run checkcodex/issue-<number>-<slug>devNotes
--diff HEAD~3...HEAD)git archiveon non-APFS/non-reflink filesystems