perf(native): raise native edge-building threshold to smallFilesThreshold#940
perf(native): raise native edge-building threshold to smallFilesThreshold#940carlos-alm merged 2 commits intomainfrom
Conversation
…hold The hardcoded > 3 threshold for native import/call edge building triggered on 5-file incremental builds, but the napi-rs marshaling cost (~13ms) exceeded Rust computation savings at that scale. Raise the threshold to use ctx.config.build.smallFilesThreshold (default 5) so small incremental builds use the JS edge path, aligning with the same threshold used for insertNodes and structure. Closes #936 Impact: 1 functions changed, 5 affected
|
Claude finished @carlos-alm's task —— View job Reviewing PR #940: perf(native): raise native edge-building threshold to smallFilesThreshold Review Progress
Phase 1: Root Cause Analysis ✅Problem Being Solved: Performance optimization for small incremental builds. The hardcoded Why This Approach: The change replaces the hardcoded threshold with Root Cause Assessment: ✅ This appears to be a legitimate performance optimization addressing real overhead, not symptom hiding. Phase 2: Configuration Change Detection ✅HIGH-RISK CHANGES: None detected.
CONFIGURATION ANALYSIS: The change uses an existing configuration value ( Phase 3: Test Integrity ✅RED FLAGS: None detected.
Phase 4: Code Quality ✅IMPLEMENTATION ANALYSIS:
CODE LOCATIONS (
Phase 5: Backlog Compliance ✅Zero-dep: ✓ — No new runtime dependencies added Root Cause AnalysisProblem Being Solved: napi-rs marshaling overhead exceeding computation savings for small incremental builds (4-5 files) Backlog Compliance
Critical ConcernsNone. This is a well-executed performance optimization that follows established patterns. Final Recommendation
Minor notes: The test plan mentions manual verification with |
Greptile SummaryThis PR replaces two hardcoded Confidence Score: 5/5Safe to merge — a clean, single-line threshold alignment with no logic changes or correctness risk. The change replaces a hardcoded literal No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[buildEdges called] --> B{isFullBuild OR\nfileSymbols.size >\nsmallFilesThreshold?}
B -- yes, native available --> C[useNativeImportEdges = true]
B -- no / no native --> D[buildImportEdges JS]
C --> E[buildImportEdgesNative]
E --> F{0 edges but\nhas imports?}
F -- yes --> G[fallback: buildImportEdges JS]
F -- no --> H[call-edge decision]
D --> H
G --> H
H --> I{isFullBuild OR\nfileSymbols.size >\nsmallFilesThreshold?}
I -- yes, native available --> J[buildCallEdgesNative]
I -- no / no native --> K[buildCallEdgesJS]
J --> L[insert edges]
K --> L
Reviews (1): Last reviewed commit: "perf(native): raise native edge-building..." | Re-trigger Greptile |
Codegraph Impact Analysis1 functions changed → 5 callers affected across 3 files
|
Summary
> 3toctx.config.build.smallFilesThreshold(default 5)Closes #936
Test plan
codegraph build --engine native --timingon a 5-file incremental — edges phase should drop from ~42ms to ~29ms