[perf] async/await parallelization - plan loop + chunk batch + file ops#787
[perf] async/await parallelization - plan loop + chunk batch + file ops#787jlin53882 wants to merge 4 commits intoCortexReach:masterfrom
Conversation
Add unit tests to prove async/await parallelization opportunities: - memory-compactor plan loop: 10x speedup possible - store.ts doFlush chunk: 2.5x speedup possible - self-improvement-files ensureFile: 2x speedup possible Refs: Issue CortexReach#785
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ea1997c7cd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| console.log(`Sequential: ${seqTime.toFixed(0)}ms`); | ||
| console.log(`Parallel: ${parTime.toFixed(0)}ms`); | ||
| console.log(`Speedup: ${(seqTime / parTime).toFixed(1)}x`); | ||
| console.log(seqTime > parTime * 2 ? "✅ ISSUE CONFIRMED" : "❌ No significant difference"); |
There was a problem hiding this comment.
Fail the proof when the speedup threshold is missed
When this script is used as the added unit-test proof, a regression or noisy environment where the parallel path is not faster only prints ❌ No significant difference; the process still exits 0 and the final summary still says all issues were verified. This makes the new proof unable to fail CI or manual validation in the exact scenario it is meant to catch; convert these checks to assertions or set a non-zero exit code on failure.
Useful? React with 👍 / 👎.
- memory-compactor.ts: parallelize plan loop with Promise.all (15.7x speedup) - self-improvement-files.ts: parallelize file operations (2.0x speedup) - Add test file with assertions verifying the fixes work Test results: - memory-compactor plan loop: 1107ms -> 70ms (15.7x) - self-improvement-files ensureFile: 93ms -> 48ms (2.0x) Refs: Issue CortexReach#785
0a45a71 to
03a4de9
Compare
|
Review finding: P1: The updated It also appears to drop the previous tail of the test script after |
- Add back test/tier1-counters.test.mjs which was dropped during edit - Fix '&& &&' extra amp-amp sequence before async-parallelization test Fixes PR787 test script issue.
✅ 問題已修復(commit
|
Summary
Add async/await parallelization opportunities analysis with unit test proof.
Unit Test Results
Changes
Related Issues
Next Steps
This PR adds test verification. Additional code changes:
See Issue #785 for detailed recommendations.