Skip to content

perf(core): P3 remove quadratic snapshot directory scans — red-first - #24

Merged
AlexanderLevenskikh merged 5 commits into
mainfrom
test/p3-linear-module-resolution-20261123
Nov 23, 2026
Merged

AlexanderLevenskikh merged 5 commits into
mainfrom
test/p3-linear-module-resolution-20261123

Conversation

@AlexanderLevenskikh

Copy link
Copy Markdown
Contributor

Initial commit 52e39ab contains tests ONLY. Source-backed baseline is first P7 exact #45155575563: 2194/5006/4426 indexed files cost 13.7/84.7/96.4 seconds; earlier exposed TanStack Table 3146 files ~26.5s. The current directoryExists repeatedly spreads all file keys for each module resolution. Deterministic Map-key-visit test must RED before fix, while retaining all 200 proved static edges. Later optimize with a one-time snapshot directory set, keep all UNKNOWN and negative controls, require full 8× OS/Node+byte parity, independent original corpus and merge SHA. P7 timing informed the fix, so preserve P7 original first score but mark it exposed for future release acceptance; a fresh P8 must be recruited. No release/tag/npm publish.

Source-grounded high-latency pinned project baseline. Deterministic 200-dependency Map key visit work counter requiring 200 verified static edges; test-only RED before optimization. Preserve original eight-cell CI.
Preserve original 160000-key red witness for 200 proven edges. Index existing source directories once per graph snapshot and memoize pure per-source TypeScript config; all semantic negatives and 8-cell CI retained. No P7 label, holdout, or release changes.
…source P7 main

Preserve original quadratic 160000-key RED and bounded engine fix; add local-only 5k x3 p50/p95/RSS plus 50k x1 evidence workflow. Recheck all 8 OS/Node and full 15-project independent oracle before merge. No release.

Copy link
Copy Markdown
Contributor Author

P3 pinned before/after evidence (append-only)

  • Original test-only RED 52e39abb98887b58d7deb579b172cb505d58e0a3, Ubuntu Node22 CI #45156809769 job 137631725924: 160,000 actual snapshot key visits for 400 source files/200 verified edges, frozen upper bound 8,000. Correctness 200/200 static edges, no unknown.
  • Source-grounded prior performance: P7 original first-score #45155575563, artifact 14808372815: TanStack Query 2194 graph files/13,702 ms, Ark UI 5006/84,660 ms, shadcn-ui 4426/96,434 ms, single runs. Old exposed TanStack Table 3146/26,452 ms.
  • Independent 12-repo post-fix evaluation on engine-only SHA 1212f3cb0a3192b95a47b897c540c5da52a533e4, #45157825084: 98 manual labels 58TP/40TN and 3965 named-import pairs 3940TP/25TN, 0 FP/FN, Knip original 3/3. TanStack Table cold index observed 8,379 ms. Different CI runs, do not infer population-wide speedup.
  • Actual 5k/50k profiling on P7-joined SHA 46d9eea40774c3bd3b71f2bcb72741f680eb0462, #45159029123, artifact 14810446100, ZIP SHA256 639ccc310dbaba5f77d001e0370a1647b700a7d3e263fb1c0d1fbd6136d0c8b5: Linux Node 22.23.5, 5000 TS files x3: cold p50 2027 ms, p95 2418 ms; warm p50/p95 113/119 ms, one-edit 516/524 ms, peak RSS 245 MiB. 50,000 TS files x1: cold 17,874 ms, warm 1452 ms, one-edit 5251 ms, RSS 690 MiB. 50k p50/p95 intentionally null, not inferred.

The synthetic import chain does not represent all monorepos. P7 helped identify the performance bottleneck; mark P7 exposed for later release-level post-change accuracy, retain its untouched first result and prepare a fresh P8. Do not merge until complete unchanged 8 OS/Node CI + byte parity and independent 15-project TypeChecker/Knip on exact updated PR SHA; then re-check merge SHA. No release/tag/npm publish.

Preserve 160000-key RED regression and exact directory-index optimizer, graft on PR23 accepted main. Recheck all OS/Node 8-platform parity, 15 source oracle/Knip and 5k/50k profile, no P7 labels/release changes.
Retain original 5000 x3 and 50000 x1 results as historical, collect 50000 x3 cold/warm/single-file-edit RSS on same runner without claiming population speed. Preserve all independent accuracy/byte parity gates.

Copy link
Copy Markdown
Contributor Author

P3 supplemental repeated 50k performance evidence (append-only)

On exact updated PR SHA cd41d0b31f7e8c592dba364537e9d2a368a11c6c, P3 profile run #45161031819 SUCCESS, artifact 14811370716 contains three distinct read-only runs of both 5000 and 50000 TypeScript files, all with cold, warm, and one-file-edit indexing. I inspected the archived p3-profile.json (status MEASURED, no error):

Metric 5000 files (3 runs) 50000 files (3 runs)
Cold p50/p95 956 / 1302 ms 7895 / 8010 ms
Warm p50/p95 64 / 70 ms 723 / 750 ms
Single edit p50/p95 301 / 318 ms 3239 / 3271 ms
Max RSS 264 MiB 865 MiB

All samples generated 5001 / 50001 indexed files, 15001 / 150001 edges; profile input is a synthetic import chain, not real-monorepo/poulation latency. Report p95 is the maximum of only three observations, not a confidence interval. Preserve earlier original 50k x1 artifact 14810446100 as historical rather than replacing evidence. Full eight-platform push/PR + byte parity, independent 15-source/Knip and exact merge-SHA gates remain mandatory; do not release.

@AlexanderLevenskikh
AlexanderLevenskikh marked this pull request as ready for review November 23, 2026 11:05
@AlexanderLevenskikh
AlexanderLevenskikh merged commit b035179 into main Nov 23, 2026
21 checks passed
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.

1 participant