Add MemorySegment-based RAVV for Fvec files #601
+230
−0
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.
JVector provides methods for reading fvec and ivec files in
jvector-examples/.../SiftLoader. These methods return a List by loading all the vectors into memory. This doesn't work in cases where the total size of the vectors exceeds the available memory, which in turn means that consuming applications likeBenchYAMLcannot work with larger-than-memory datasets.This PR adds
FvecSegmentReadertojvector-nativeas an experimental API. In the future, it's possible to integrate this withMultiFileDataSourceto allow benchmarking of larger-than-memory datasets.Alternate approaches
SiftLoader.readFvecs. This is fundamentally limited by being unable to process larger-than-memory datasets.ReaderSupplierFactory.open(). This re-uses existing code and will automatically fall back toMMapReaderon lower JDK versions. However, this makes the implementation a bit clunky since theRandomAccessReaderinterface is not thread-safe, which would force us to use a thread-safe MemorySegment in a defensive manner. Using theMemorySegmentAPI directly makes the code cleaner and more self-contained.Possible next steps
BenchYAMLto add support for larger-than-memory datasets.