Skip to content

Stevenic/perf improvements#124

Merged
Stevenic merged 5 commits into
mainfrom
stevenic/perf-improvements
May 24, 2026
Merged

Stevenic/perf improvements#124
Stevenic merged 5 commits into
mainfrom
stevenic/perf-improvements

Conversation

@Stevenic
Copy link
Copy Markdown
Owner

No description provided.

Stevenic added 5 commits May 24, 2026 09:39
 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).
@Stevenic Stevenic merged commit 7052e73 into main May 24, 2026
1 check passed
@Stevenic Stevenic deleted the stevenic/perf-improvements branch May 24, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant