ashvardanian/StringZilla
FreeUp to 100x faster strings for C, C++, CUDA, Python, Rust, Swift, JS, & Go, leveraging NEON, AVX2, AVX-512, SVE, GPGPU, & SWAR to accelerate search, hashing, sorting, edit distances, sketches, and memory ops 🦖
About ashvardanian/StringZilla
StringZilla is a high-performance string processing library that leverages SIMD (NEON, AVX2, AVX-512, SVE) and SWAR instructions to accelerate common string operations such as exact and fuzzy matching, hashing, sorting, edit distances, segmentation, tokenization, random string generation, and memory operations. It provides allocation-free lazily-evaluated iterators and claims to be up to 100x faster than traditional libraries like LibC for substring search on Arm, 10–70x faster than ICU for UTF-8 handling, case folding, segmentation, and tokenization, and up to 100x faster than NVIDIA's libraries for on-GPU Levenshtein, Needleman-Wunsch, and Smith-Waterman edit distances. StringZilla supports multiple programming languages including C, C++, CUDA, Python, Rust, Swift, Go, JavaScript, and includes backends for WebAssembly, RISC-V, PowerPC, and LoongArch.
Key Features
Pros & Cons
- Claims dramatic speedups: 3x faster than LibC for substring search on Arm, 10–70x faster than ICU for UTF-8 operations, up to 100x faster than NVIDIA's libraries for GPU edit distances
- Portable across architectures with automatic SIMD dispatch and custom backends (x86, ARM, RISC-V, PowerPC, LoongArch, WebAssembly)
- Provides familiar drop-in replacements for standard library string types in multiple languages
- Open source with permissive license (MIT) and no external dependencies
- Includes lazy iterators for memory efficiency
- Performance gains depend on hardware SIMD support; may have limited benefit on older CPUs without SIMD extensions
- Not a drop-in replacement for all string operations; requires code changes to use the library
- Relatively new and less widely adopted than standard libraries, potentially smaller community and fewer resources