feat(vectorise): add --batch-size option for memory-efficient processing#306
Open
superbiche wants to merge 1 commit intoDavidyz:mainfrom
Open
feat(vectorise): add --batch-size option for memory-efficient processing#306superbiche wants to merge 1 commit intoDavidyz:mainfrom
superbiche wants to merge 1 commit intoDavidyz:mainfrom
Conversation
Process files in batches to limit concurrent asyncio task creation, reducing RAM spikes when vectorizing large projects (1000+ files). - Default batch size of 100 files - Use -1 to disable batching (original behavior)
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #306 +/- ##
=======================================
Coverage 99.72% 99.72%
=======================================
Files 25 25
Lines 1845 1851 +6
=======================================
+ Hits 1840 1846 +6
Misses 5 5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
Adds a
--batch-size/-boption to thevectorisecommand that controls how many files are processed concurrently.-1to disable batching (process all files at once, legacy behavior)This addresses memory exhaustion issues when vectorizing large codebases with thousands of files, as it limits the number of concurrent async tasks created.
Changes
batch_sizefield toConfigdataclass with default value of 100-b/--batch_sizeCLI argument tovectorisesubparservectorise()to process files in batches using the configured batch sizeTest plan
pytest tests/subcommands/test_vectorise.py -v- all tests passvectorcode vectorise /large/project -r -b 50processes files in batchesvectorcode vectorise /project -r -b -1processes all files at once (legacy)