feat: add sparse on-disk format for presence matrices

The index packing API now accepts a `sparse` parameter to generate `PersistentSparseBitMatrix` files alongside existing dense matrices. The sibling cache automatically detects this format via an `is_multi.prsb` marker file and routes queries identically to the dense variant. A new `--sparse` CLI flag exposes the option, with tests verifying end-to-end pipeline correctness and storage equivalence.
This commit is contained in:
Eric Coissac committed 2026-08-16 21:51:02 +02:00
1 parent 50f4820cb9
commit 3ba26b3dc1
14 files changed
+279 -24

No files matched your search

+9 -1
View File
@@ -9,6 +9,14 @@ use tracing::info;
pub struct PackArgs {
/// Index directory to pack
pub index: PathBuf,
/// Pack presence matrices into the sparse, deduplicated on-disk format
/// instead of the dense one — see `docmd/architecture/siblings.md`.
/// Smaller and faster for single-row access on real, sparse data;
/// column-oriented access (`--metric` distance matrices) is much
/// slower on the sparse format.
#[arg(long)]
pub sparse: bool,
}
pub fn run(args: PackArgs) {
@@ -33,7 +41,7 @@ pub fn run(args: PackArgs) {
let mut rep = Reporter::new();
let t = Stage::start("pack");
idx.pack_matrices().unwrap_or_else(|e| {
idx.pack_matrices(args.sparse).unwrap_or_else(|e| {
eprintln!("pack error: {e}");
std::process::exit(1);
});