Skip to content

v0.2.0

Choose a tag to compare

@adamdeprince adamdeprince released this 19 May 11:45

Levenshtein + Damerau-Levenshtein, multi-arch SIMD batch.

What's new since v0.1.0

  • Multi-word Levenshtein SIMD for patterns up to 256 chars (W = 2/3/4).
  • score_cutoff parameter on every levenshtein_* function. Per-lane done masks + all-lanes early-exit; up to 6x rapidfuzz on cutoff workloads.
  • Zero-copy singular dispatch for bytes / 1-byte unicode (levenshtein_score(q, t) skips the prepare_alignment vector copy).
  • Damerau-Levenshtein (OSA-restricted, Hyyrö 2002) — scalar bit-parallel + SIMD batch. New API: damerau_levenshtein_score, _normalized_score, _scores, _normalized_scores.
  • NeonOps / LsxOps / LasxOps / VsxOps Ops bundles. Combined with the existing x86 SSE/AVX2/AVX-512/AVX10 bundles, every SIMD ISA we support now has a multi-target Levenshtein and Damerau-Levenshtein kernel:
    • Intel SSE4.1 / AVX2 / AVX-512 / AVX10-256 / AVX10-512
    • Apple Silicon NEON (macOS arm64)
    • AArch64 NEON / SVE / SVE2 (Linux)
    • LoongArch LSX / LASX
    • PowerPC VSX (Power8+)

Highlight benchmarks vs rapidfuzz / python-Levenshtein

arch workload ratio
Intel AVX-512 Lev medium q=100, 1-vs-200 3.03x rapidfuzz
Intel AVX-512 Damerau short q=20, 1-vs-1000 4.22x rapidfuzz OSA
Intel AVX-512 Lev cutoff q=50, K=12 6.03x rapidfuzz
Mac M4 NEON Lev short q=30, 1-vs-1000 8.54x python-Levenshtein
Mac M4 NEON Damerau short q=30, 1-vs-1000 7.45x rapidfuzz OSA
Graviton4 (NEON/SVE/SVE2) Lev short q=30, 1-vs-1000 4.05x python-Levenshtein
Power8 VSX Lev multi-word q=200, 1-vs-200 3.03x vs generic
Loongson LASX Lev multi-word q=100, 1-vs-200 3.34x vs generic

Full benchmarks in BENCHMARK.md.

Installation

```bash
pip install stride-align==0.2.0
```

PyPI has wheels for Python 3.10-3.14 on Linux x86_64 (manylinux_2_28), Linux aarch64 (manylinux_2_39), Linux ppc64le (manylinux_2_34), and macOS arm64. LoongArch64 wheels are attached to this release (PyPI doesn't accept the linux_loongarch64 platform tag); install with:

```bash
PY=$(python3 -c 'import sys; print(f"cp{sys.version_info.major}{sys.version_info.minor}")')
pip install https://github.com/adamdeprince/stride-align/releases/download/v0.2.0/stride_align-0.2.0-\${PY}-\${PY}-linux_loongarch64.whl
```