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

LibraryBundle Size (gzip)AlgorithmQuery Latency p50Query Latency p95Index Size (10K docs)Index BuildOfflineSemantic
altor-vec54 KBHNSW (WASM)0.6ms0.9ms~18 MB (.bin file)2.1s (offline)YesYes
Fuse.js5 KBBitap fuzzy scan8ms12msIn-memory onlyNone (runtime)YesNo
MiniSearch13 KBInverted index + BM253ms5ms~2 MB (in-memory)0.4s (runtime)YesNo
Important: these libraries solve different retrieval problems. altor-vec measures semantic vector search over embeddings, while Fuse.js and MiniSearch measure keyword and fuzzy text retrieval over raw strings.

Methodology

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.