Repository navigation
Pari 0.4.4 alpha
Pre-releasePari 0.4.4 alpha
Pari 0.4.4 alpha adds bounded-memory tools for large corpora: a verified
read-only build that folds appended commits without loading the index, and a
dedup mode that groups inputs larger than memory. MinHash signatures and
full index rebuilds are also faster.
Installation
python -m pip install "pari-similarity==0.4.4"
cargo add pari-core@0.4.4 pari-index@0.4.4 pari-store@0.4.4Python imports remain import pari. Keep all four public Rust crates on the
same release version. CLI archives, checksums, and the dependency SBOM are
attached to the
GitHub release with
GitHub build provenance attestations.
Build a read-only copy in bounded memory
pari build-read-only --index SRC --output DEST and
pari.build_read_only_index(source, destination) write a verified,
query-ready copy of a committed index without loading it into memory. The copy
opens with ReadOnlyIndex, pari search --read-only, and the writers.
- Appended commits are folded in while reading. The base snapshot and
every delta generation are merged as sorted streams, so an index fresh from
an incremental ingest needs nocompactfirst. The output is byte-for-byte
what compacting and then building produces, and the source is not changed. - A compacted source's buckets are reused. The builder checks that the
source's bucket sections are exactly what a rebuild would write, using
checksums, ordering, segment boundaries, and a randomly keyed hash of every
bucket entry, then copies them. If any check fails, it rebuilds them, so the
output is the same either way. - An existing destination is never replaced.
At 10M items, reusing verified buckets built a read-only copy of a compacted
index in 16.2 s, against 56.6 s for a full rebuild in the same run (3.5x).
The Rust BuildOptions::default() now reuses verified buckets too, matching
the CLI and Python. BuildStats reports reused_source_buckets and
folded_generations.
Deduplicate inputs larger than memory
pari dedup --spill-dir DIR groups duplicates without an in-memory index.
Each record's band hashes are sorted in runs spilled to DIR and merged, so
each bucket's members arrive together. Signatures for --min-similarity stay
on disk and are read only for buckets whose members are not yet connected.
The groups are identical to the in-memory path, and every temporary file is
removed afterwards. This mode writes groups only.
| 1M records, measured locally | time | peak memory |
|---|---|---|
pari dedup in memory |
13.6 s | 1,325 MB |
pari dedup --spill-dir |
13.5 s | 124 MB |
in memory, --min-similarity 0.7 |
13.7 s | 2,390 MB |
--spill-dir, --min-similarity 0.7 |
21.8 s | 124 MB |
LshIndex32::band_hashes and LshIndex64::band_hashes return the band hashes
an index buckets a sketch under, for tools that group outside the index.
Faster signatures and rebuilds
MinHash signatures take each permutation's minimum without a branch, so the
update loop vectorizes for both signature widths. Signatures are unchanged.
| 10M items, same VM per row | 0.4.3 | 0.4.4 |
|---|---|---|
| Signature construction | 130,700 items/s | 166,300 items/s |
| Full read-only rebuild, no bucket reuse | 69.3 s | 51.7 s |
The external builder reads keys and band hashes sequentially instead of
seeking for every item when it spills records.
Compatibility
The file format is unchanged; files are interchangeable with 0.4.3. The public
crates only gain the band_hashes methods. pari-store-build is not a
published crate; its BuildOptions and BuildStats gained fields.