MB-71397: Fix the output of Size API of VectorIndex#408
Open
CascadingRadium wants to merge 16 commits into
Open
MB-71397: Fix the output of Size API of VectorIndex#408CascadingRadium wants to merge 16 commits into
Size API of VectorIndex#408CascadingRadium wants to merge 16 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts how vector-index memory usage is reported by VectorIndex.Size(), avoiding FAISS Size() calls that are misleading under mmap, and additionally accounting for wrapper-side structures like ID mappings and exclusion bitmaps.
Changes:
- Reworked
vectorIndexWrapper.Size()to sum sizes from the FAISS index wrapper,idMapping, and exclusionbitmap, removing the previously cachedvecIndexSize. - Added approximate sizing helpers for
idMappingandbitmapusingreflect-based static sizing plus backing-slice contributions. - Updated FAISS index wrapper
size()implementations (float32, GPU float32, binary IVF) to avoid calling FAISSSize()under mmap and instead return a reflect-based static size.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| faiss_vector_wrapper.go | Adds reflect-based static sizing, introduces bitmap.size()/idMapping.size(), and updates VectorIndex.Size() to aggregate sizes. |
| faiss_vector_posting.go | Removes initialization of the cached vecIndexSize in InterpretVectorIndex(). |
| faiss_vector_index_float32.go | Changes FAISS float32 index size() to return reflect-based static size instead of idx.Size(). |
| faiss_vector_index_gpu_float32.go | Changes GPU float32 index size() to return reflect-based static size instead of cpuIdx.Size(). |
| faiss_vector_index_bivf.go | Changes binary IVF index size() to return reflect-based static size instead of binary.Size()+backing.Size(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
capemox
previously approved these changes
May 11, 2026
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Member
|
looks good, but can you attach the MB associated with this? |
Size API of VectorIndexSize API of VectorIndex
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.
VectorOptimizeAPI ofbleve:0.000152587890625 MB171.66588592529297 MB