Add: reserve parameter added to Index for c# sdk#666
Open
jamesryanbell wants to merge 1 commit intounum-cloud:mainfrom
Open
Add: reserve parameter added to Index for c# sdk#666jamesryanbell wants to merge 1 commit intounum-cloud:mainfrom
jamesryanbell wants to merge 1 commit intounum-cloud:mainfrom
Conversation
Author
|
Hi @ashvardanian, do you know when someone will be able to review this please |
Contributor
|
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? |
Author
|
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 |
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.
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.