- Notifications
You must be signed in to change notification settings - Fork240
Add: reserve parameter added to Index for c# sdk#666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
jamesryanbell commentedOct 21, 2025
Hi@ashvardanian, do you know when someone will be able to review this please |
ashvardanian commentedOct 21, 2025
Hi@jamesryanbell! Thanks for the PR! I don't yet see the relationship between the proposed APIs and multi-threading in#441. Why do we need a reserve argument in multiple methods as opposed to a single reserve method? |
jamesryanbell commentedOct 22, 2025
Hi@ashvardanian, when I try and create an index using multiple threads I run into an issue where the capacity is not increased. This change would allow me to set the capacity before the parallel operation. I can't resize increase the capacity currently as |
Add
reserveparameter to all USearchIndex constructorsThis addresses#441
Summary
This PR adds an optional
reserveparameter to all three USearchIndex constructors to allow pre-allocation of memory for incoming vectors, improving performance when the expected number of vectors is known in advance.Changes Made
1. First Constructor (Parameter-based)
2. Second Constructor (IndexOptions-based)
if (reserve > 0) { this.IncreaseCapacity(reserve); }3. Third Constructor (File-based)
if (reserve > 0) { this.IncreaseCapacity(reserve); }Benefits
0ensures existing code continues to workUsage Examples
Breaking Changes
None - this is a purely additive change with default parameter values.