Performance & Benchmarks
Relevant source files
The following files were used as context for generating this wiki page:
Performance is a foundational pillar of the EdgeVec project, which aims to provide a high-performance, WebAssembly (WASM)-first vector database. The system is architected to meet "Nvidia Grade" standards, characterized by strict performance budgets, extensive use of SIMD acceleration, and rigorous competitive benchmarking against native and browser-based alternatives. Sources: Cargo.toml:13, GATE_1_COMPLETE.md:144-155
The project utilizes a comprehensive suite of benchmarks ranging from low-level SIMD instruction measurements to end-to-end competitive analysis and long-duration stress tests. These benchmarks ensure that the HNSW implementation remains within its memory budget of less than 100 bytes of overhead per vector while maintaining sub-10ms search latencies for 100k vectors. Sources: GATE_1_COMPLETE.md:94-106, wasm/examples/benchmark-dashboard.js:14-15
Performance Architecture & Targets
EdgeVec defines specific performance budgets for its core operations to ensure predictability in resource-constrained environments like mobile browsers. These targets are validated through a multi-layered testing strategy including Criterion-based microbenchmarks in Rust and browser-based performance dashboards. Sources: GATE_1_COMPLETE.md:144-155, Cargo.toml:137-142
Operations & Budgets
| Operation | Target Performance | Verification Method |
|---|---|---|
| Search (100k vectors) | <10ms P99 | Competitive Harness / Benchmark Dashboard |
| Insert (single) | <1ms Mean | Criterion / Batch Insert Benchmark |
| Index Load (100k) | <500ms | Persistence Benchmarks / Stress Test |
| Memory Overhead | <100 bytes/vector | Data Layout Verification |
| Bundle Size | <500KB gzipped | Build Verification Script |
Sources: GATE_1_COMPLETE.md:144-155, scripts/pre-release-check.sh:163-176
Memory Efficiency
The architecture utilizes arena-based contiguous allocation and VByte delta encoding for compressed neighbor storage to minimize memory footprint. For 100k vectors at 768 dimensions, the actual overhead per vector is measured at 82.125 bytes, significantly below the 100-byte target. Sources: GATE_1_COMPLETE.md:105-116, GATE_1_COMPLETE.md:124-127
SIMD Acceleration (SIMD128)
EdgeVec leverages WASM SIMD128 to accelerate vector operations, achieving throughputs of over 2 Gelem/s (Giga-elements per second). The system detects SIMD support at runtime and falls back to scalar implementations if necessary. Sources: wasm/examples/simd_benchmark.html:434-442, wasm/examples/simd_benchmark.html:565-573
The following diagram illustrates the SIMD execution flow for dot product calculations:
EdgeVec uses f32x4.mul, f32x4.add, and horizontal sums to process 4 float32 values simultaneously in a single 128-bit register. Sources: wasm/examples/simd_benchmark.html:443-462
Accelerated Metrics
The SIMD benchmark suite measures several critical distance metrics:
- Dot Product: Core similarity metric for normalized vectors.
- L2 Distance: Euclidean distance for magnitude-sensitive similarity.
- Cosine Similarity: Angular similarity between vectors.
- Hamming Distance: Optimized specifically for Binary Quantization (BQ). Sources: wasm/examples/simd_benchmark.html:490-505
Competitive Benchmarking
The project includes a dedicated benchmarking harness (harness.js) and a dashboard to compare EdgeVec against competitor libraries:
- hnswlib-node: A native C++ implementation (used as the performance baseline).
- voy: A competitor WASM-based vector database.
Sources: benches/competitive/harness.js:14-22, wasm/examples/benchmark-dashboard.js:33-40
Benchmark Flow
The competitive harness follows a standardized execution flow to ensure fair comparison, including warmup periods and multiple measurement runs.
Benchmark Configuration
The standard competitive configuration uses the following parameters to ensure cross-library consistency:
- Dimensions: 128
- Vector Count: 10,000 (standard) / up to 100,000 (stress)
- HNSW M: 16
- EF Construction: 200
- EF Search: 50
- Measurement Runs: 5
Sources: benches/competitive/harness.js:31-45
Stress Testing & Stability
The Stress Test suite pushes EdgeVec to its limits by executing continuous batch operations and monitoring for performance degradation or stability issues at high scales (up to 100,000 vectors). Sources: wasm/examples/stress-test.html:362-375
Stress Test Phases
The suite evaluates performance through four distinct levels:
- Quick Test: 1,000 vectors; basic validation of WASM loading.
- Medium Test: 1,000 + 10,000 vectors; validates performance scaling.
- Full Stress: Up to 50,000 vectors; tests IndexedDB persistence limits.
- Extreme Test: 100,000 vectors; verifies memory budget compliance and large-scale search accuracy.
Sources: wasm/examples/stress-test.html:364-380
Persistence Performance
The stress test specifically measures the latency of save and load operations to IndexedDB. For 100k vectors, targets include index load times under 500ms to ensure a responsive user experience in browser-based applications. Sources: wasm/examples/stress-test.html:534-565, GATE_1_COMPLETE.md:148
Batch Insert Performance
EdgeVec provides optimized batch insertion APIs to maximize throughput during initial index population. Benchmarks comparing sequential versus batch insertion show significant "Batch Efficiency Ratios" due to reduced WASM boundary crossings and optimized internal arena allocations. Sources: wasm/examples/batch_insert.html:343-355, wasm/examples/stress-test.html:512-524
// Example: Batch insert with progress tracking
const result = index.insertBatchWithProgress(vectors, (done, total) => {
if (done === 0) {
log(`Batch insert started (${total} vectors)`);
} else if (done === total) {
log(`Batch insert complete`);
}
});
Sources: wasm/examples/stress-test.html:517-524
Summary
EdgeVec's performance is maintained through a combination of compile-time verification (using const_assert! for data layout), runtime SIMD acceleration, and continuous benchmarking. By adhering to a sub-100 byte overhead per vector and sub-10ms search latency, the project provides a viable high-performance alternative to native vector databases within the browser environment. Sources: GATE_1_COMPLETE.md:135-142, wasm/examples/simd_benchmark.html:436-440