$ memista

memista vs hnsw_rs

updated 2026-06-01 · grounded in source

hnsw_rs is a pure-Rust HNSW implementation. memista wraps USearch — a C++/Rust HNSW implementation — behind an HTTP server and a SQLite metadata layer. Both target Rust developers who want vector search inside their own binary; the two projects make different trade-offs about scope.

dimensionmemista 0.1.xhnsw_rs (jean-pierreBoth/hnswlib-rs)
Index implementationUSearch (C++ core, Rust bindings)pure Rust
LayerLibrary + HTTP serviceLibrary only
Vectors per leafn/a (multi: true)configurable
Distance traitMetricKind enum (IP, Cosine, L2, …) — IP in memistaDistance trait, user-implementable
Generic over scalar typeF32 only in memista (USearch supports more)generic via the Distance trait
Metadata storageSQLite WAL, joined automaticallynone — you bring your own
Persistence<db_id>.usearch file (USearch native format)dump / reload (its own format)
HTTP serveryes (Actix-web)no
OpenAPIyes (apistos)no
SIMDyes via simsimd featureyes, hand-written in some metrics
ParallelismTokio runtime + Rayon dep declaredRayon-based parallel insert / search
Multi-tenantby database_idone index per Hnsw<T,D> instance
Async-friendlycore is sync, wrapped in async handlerssync core
LicenseGPL-3.0MIT/Apache-2.0 (typical for the crate)
Maturityexperimental per READMEmature, widely used

Where the two crates actually differ

Implementation language. hnsw_rs is pure Rust. USearch is C++ with Rust bindings. For most users this is invisible. For users who care about a fully-Rust dependency tree (no cc linker, no cmake, easier cross-compilation to esoteric targets), hnsw_rs wins by construction.

Distance metrics. hnsw_rs lets you implement a Distance trait for your own type. You can put f16 vectors, integer vectors, packed bit vectors, anything you can compute a distance over. memista accepts Vec<f32> and computes inner product. The flexibility difference is real.

Service shape. This is the largest difference. hnsw_rs is a pure library — you build the index, you query it, you save it, you load it. memista hands you a working HTTP server with three REST endpoints and four flavours of generated documentation, and a SQLite database wired up to store the text that produced each vector. If your application already has a service skeleton you’re embedding in, hnsw_rs is the cleaner choice. If you want a single binary that runs vector search end-to-end, memista is the shorter path.

Multi-tenancy. memista’s database_id partitioning is a real ergonomic feature for SaaS-shaped workloads — each tenant gets isolated storage by name, with no extra code. hnsw_rs leaves this entirely to you; you’d hold a HashMap<TenantId, Hnsw<...>> or one process per tenant.

Tuning surface. hnsw_rs gives you M, ef_construction, ef_search, and the max-layer parameter directly. memista currently passes 0 for connectivity, expansion_add, and expansion_search, meaning you get USearch’s defaults. To tune, you fork the load_or_create_index helper. For workloads where recall vs. latency tuning matters, hnsw_rs is more honest about asking you to choose.

Where they agree

Both are embeddable. Both are HNSW. Both will give you sub-millisecond queries on a hundred-thousand-vector index on a laptop. Both ship as a single Cargo dependency. Both persist to disk.

If your workload is small enough that the algorithmic choices don’t matter — and on embeddable workloads, that’s often the case — the choice comes down to whether you want a library or a service.

When to pick hnsw_rs

When to pick memista

The honest summary

hnsw_rs is the right choice for serious, library-shaped Rust vector search work where you want control. memista is the right choice for “I want a vector-search service in one cargo install.” They are not the same project, and the comparison is largely a comparison of scope.

Sources: memista’s src/lib.rs and Cargo.toml in this repository; hnsw_rs documentation at https://crates.io/crates/hnsw_rs.

← all comparisons