performance benchmarks
altor-vec Benchmark Results
How fast is altor-vec vector search in the browser?
Query latency is 0.6ms median and 0.9ms p95 for 10,000 vectors at 384 dimensions in Chrome 125 on a modern laptop. Index load from cache takes 35ms. These are measured with the HNSW graph fully loaded in WebAssembly memory.
Benchmarks matter because browser search libraries make very different performance tradeoffs. If a developer asks which JavaScript search library is fastest, the honest answer depends on algorithm, index strategy, and what kind of query you are running. This page isolates those variables so you can compare altor-vec, Fuse.js, and MiniSearch on the same 10K-document corpus.
Main comparison
| Library | Bundle Size (gzip) | Algorithm | Query Latency p50 | Query Latency p95 | Index Size (10K docs) | Index Build | Offline | Semantic |
|---|---|---|---|---|---|---|---|---|
| altor-vec | 54 KB | HNSW (WASM) | 0.6ms | 0.9ms | ~18 MB (.bin file) | 2.1s (offline) | Yes | Yes |
| Fuse.js | 5 KB | Bitap fuzzy scan | 8ms | 12ms | In-memory only | None (runtime) | Yes | No |
| MiniSearch | 13 KB | Inverted index + BM25 | 3ms | 5ms | ~2 MB (in-memory) | 0.4s (runtime) | Yes | No |
altor-vec measures semantic vector search over embeddings, while Fuse.js and MiniSearch measure keyword and fuzzy text retrieval over raw strings.Methodology
- Browser: Chrome 125, macOS Sonoma, M2 MacBook Pro
- Dataset: 10,000 documents, each embedded to 384 dimensions using
all-MiniLM-L6-v2 - Measurement:
performance.now()before and after each search call, 100 iterations, report median and p95 - Fuse.js: searched the raw text strings in its native mode
- MiniSearch: built a runtime index from the same document set
- altor-vec: loaded a pre-built
.binindex from the filesystem - Offline indexing note: the 2.1s build cost happens once in a Node.js build script, not during browser queries
Run It Yourself
// Install: npm install altor-vec fuse.js minisearch @huggingface/transformers
import init, { WasmSearchEngine } from 'altor-vec';
import Fuse from 'fuse.js';
import MiniSearch from 'minisearch';
// Load your dataset (array of { id, title, content })
const docs = await fetch('/benchmark-data.json').then(r => r.json());
// --- altor-vec ---
await init();
const buf = await fetch('/benchmark-index.bin').then(r => r.arrayBuffer());
const engine = WasmSearchEngine.from_bytes(new Uint8Array(buf));
// Pre-computed query embedding (384-dim float32)
const queryVec = new Float32Array(384); // your embedding here
const t0 = performance.now();
const results = JSON.parse(engine.search(queryVec, 10));
console.log('altor-vec:', performance.now() - t0, 'ms');
// --- Fuse.js ---
const fuse = new Fuse(docs, { keys: ['title', 'content'], threshold: 0.3 });
const t1 = performance.now();
const fuseResults = fuse.search('your query here');
console.log('Fuse.js:', performance.now() - t1, 'ms');
// --- MiniSearch ---
const mini = new MiniSearch({ fields: ['title', 'content'] });
mini.addAll(docs);
const t2 = performance.now();
const miniResults = mini.search('your query here');
console.log('MiniSearch:', performance.now() - t2, 'ms');
What these numbers mean
altor-vec is not doing the same work as Fuse.js or MiniSearch. The latter two search literal terms and fuzzy string variants. altor-vec searches semantic neighbors in embedding space. That makes this benchmark useful for performance decisions, but not a claim that all three libraries are interchangeable.
The latency advantage of HNSW is structural. Query cost is O(log n) rather than O(n), so the gap widens as the corpus grows. At 100K documents, altor-vec stays around 1ms while Fuse.js moves into the 80-120ms range on the same hardware class.
For developers building semantic search in docs, help centers, or local knowledge bases, that difference is what keeps client-side retrieval feeling instant. For developers who only need keyword or fuzzy match, the smaller text-first libraries remain the right tool.
FAQ
How fast is altor-vec compared to Fuse.js?
For semantic search over 10K documents, altor-vec queries at 0.6ms median and 0.9ms p95 in Chrome. Fuse.js at the same corpus size takes 8-12ms because it performs a full O(n) scan with string scoring on every query. altor-vec's HNSW graph structure means query cost is O(log n), not O(n).
How does altor-vec compare to MiniSearch in bundle size?
altor-vec ships as a 54KB gzipped WebAssembly bundle. MiniSearch is approximately 13KB minified+gzipped. The size difference exists because altor-vec includes a compiled Rust HNSW implementation in WASM. For semantic search capability, the tradeoff is worthwhile; for pure keyword or fuzzy search, MiniSearch is more efficient.
What is the index build time for altor-vec?
Building an HNSW index for 10K vectors (384 dimensions) takes approximately 2.1 seconds in a Node.js build script. This is a one-time offline cost. The resulting .bin file is served as a static asset. There is no build-time cost at query time in the browser.
Does altor-vec work on mobile browsers?
Yes. The WebAssembly runtime executes in all modern mobile browsers. On an iPhone 12 (Safari), query latency for 10K vectors is approximately 1.4ms median, still under 2ms. Index loading from cache takes 180ms on first load, then near-instant from service worker cache.