Stevenic/perf improvements#124
Merged
Merged
Conversation
array. 3. Batch chunk removal in deleteDocument (src/LocalDocumentIndex.ts:180) Added a new public LocalIndex.deleteItems(ids: Iterable<string>) that does a single filter pass. deleteDocument now uses it instead of looping deleteItem per chunk, taking M-chunk deletion from O(N·M) to O(N). 4. Parallel external metadata loads in queryItems (src/LocalIndex.ts:354) Top-K metadata file reads now run concurrently via Promise.all. Tests: 7 new tests (deleteItems batch behavior + shallow snapshot semantics) plus one existing test updated to stub the new code path. 130/130 pass, lint and build clean. Docs: docs/changelog.md and docs/api-reference.md updated. Fix: addItemToUpdate now includes norm: newItem.norm in the upsert replacement (src/LocalIndex.ts:495). Previously, upserting a new vector kept the old norm, which would skew cosine-similarity rankings until the next insertItem of the same id (which isn't allowed — unique=true throws on duplicate). So in practice the stale norm could persist indefinitely on any upsertItem that changed the vector. Test: new case in beginUpdate shallow snapshot proves the norm is recomputed (insert [3,4] → norm 5, upsert [6,8] → norm 10).
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.
No description provided.