Repository navigation
Pari 0.4.1 alpha
Pre-releasePari 0.4.1 alpha
Pari 0.4.1 alpha cuts the memory of persistent indexes and of
DedupeIndex(backend="local"), and makes reopening faster.
Installation
python -m pip install "pari-similarity==0.4.1"
cargo add pari-core@0.4.1 pari-index@0.4.1 pari-store@0.4.1Python 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.
Less memory for persistent indexes
Persistent indexes (PersistentIndex32/PersistentIndex64, Python's
Index/Index64) no longer keep committed keys' band hashes in memory, only
the set of live keys and the band hashes of uncommitted keys. That is about
300 bytes per key less. A snapshot rewrite reads committed band hashes back
from the file.
DedupeIndex(backend="local") now commits each ingest batch of about 65,536
records to the file as a delta generation, instead of holding every record in
the persistence mirror until close(). close() commits the rest, releases
the in-memory index, and rewrites the file as one snapshot. A crash during
ingest keeps every committed batch.
Measured on the dedicated 12-vCPU, 132 GiB host:
| 10M items | 0.4.0 | 0.4.1 |
|---|---|---|
DedupeIndex(backend="local") peak memory |
15.9 GB | 12.1 GB |
DedupeIndex(backend="local") resident memory per item |
1,426 B | 1,063 B |
DedupeIndex(backend="local") ingest |
222 s | 205 s |
DedupeIndex(backend="local") close |
83 s | 89 s |
| Persistent index reopen | 7.13 s | 5.86 s |
| Persistent snapshot rewrite | 35.2 s | 39.1 s |
For comparison, the memory backend peaks at 11.3 GB and holds 975 bytes per
item. Groups and query candidates are identical in both releases. The rewrite
is slower because it reads committed band hashes back from disk.
Rust adds flush_delta() on persistent indexes. It commits pending changes as
an appended delta generation whatever their size, for bulk ingest that commits
often and compacts once at the end.
Behavior change
If the final commit in DedupeIndex(backend="local").close() fails, the
handle stays open with every record, as before. If that commit succeeds and
only the final rewrite fails, the handle closes and the error is raised. The
file then still holds every record as readable delta generations, and
Index.compact() can finish the rewrite.
The file format and public APIs are otherwise unchanged; files are
interchangeable with 0.4.0.