perf(core): Optimize chunk merging and avoid redundant string split in grep tool#1303
Merged
perf(core): Optimize chunk merging and avoid redundant string split in grep tool#1303
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Contributor
⚡ Performance Benchmark
Details
History
|
This comment has been minimized.
This comment has been minimized.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1303 +/- ##
==========================================
+ Coverage 87.10% 87.13% +0.02%
==========================================
Files 115 115
Lines 4358 4367 +9
Branches 1014 1015 +1
==========================================
+ Hits 3796 3805 +9
Misses 562 562 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Deploying repomix with
|
| Latest commit: |
2fac8d8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9144e5e2.repomix.pages.dev |
| Branch Preview URL: | https://perf-lazy-load-minimatch.repomix.pages.dev |
4b68828 to
3b22907
Compare
…n grep tool
- Replace string += with array accumulation + join('\n') in mergeAdjacentChunks
to avoid O(k²) copying when merging adjacent tree-sitter code chunks
- Extract searchInLines from searchInContent in grepRepomixOutputTool so
performGrepSearch splits content once and reuses the lines array for both
search and formatting, avoiding a redundant O(n) split on large files
3b22907 to
2fac8d8
Compare
This was referenced Mar 28, 2026
This was referenced Mar 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Performance optimizations for string operations in tree-sitter parsing and MCP grep tool.
Changes
mergeAdjacentChunks(parseFile.ts): Replacestring +=concatenation with array accumulation +join( )to avoid O(k²) string copying when merging adjacent code chunks.content.split( )(grepRepomixOutputTool.ts): ExtractsearchInLinesfunction that accepts pre-split lines array.performGrepSearchnow splits content once and reuses the array for both search and formatting, avoiding a redundant O(n) split on large output files (3-5MB).Checklist
npm run testnpm run lint