Expand description
True Batch SegmentWriter Ingest
High-performance batch API for segment construction that eliminates per-vector overhead and enables streaming ingest.
§Problem
Current SegmentWriter.add():
- Creates vec_owned per vector (allocation)
- Rotates synchronously (CPU bound)
- Single vector at a time (no batching benefits)
§Solution
Batch-oriented API:
- add_batch_contiguous() for bulk ingest
- Pre-allocate rotation buffers
- Parallel rotation for batch
- Direct arena storage
§Usage
use sochdb_vector::batch_segment_writer::{BatchSegmentWriter, BatchConfig};
let config = BatchConfig::default();
let mut writer = BatchSegmentWriter::new(config);
// Batch ingest
let vectors: &[f32] = &flat_data;
let ids = writer.add_batch_contiguous(vectors, dim, keys)?;
// Build segment
let segment = writer.build()?;Structs§
- Batch
Config - Configuration for batch segment writer
- Batch
Segment Writer - High-performance batch segment writer
- Batch
Write Stats - Batch write statistics
- Built
Segment - Built segment ready for use
- Stored
Vector - Stored vector with metadata
Enums§
- Batch
Write Error - Error type for batch operations
Type Aliases§
- Vector
Key - Key type for vectors