Skip to content

feat(wasm-db): add WASM support#369

Merged
deven96 merged 5 commits into
mainfrom
wasm-db
Jul 23, 2026
Merged

feat(wasm-db): add WASM support#369
deven96 merged 5 commits into
mainfrom
wasm-db

Conversation

@deven96

@deven96 deven96 commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Make db crate compile for wasm32-unknown-unknown target. Sequential fallbacks for rayon parallel iterators on WASM. SIMD via pulp for 2-4x vector operation speedup.

Create wasm-db crate with protobuf bytes API.
Full CRUD + similarity search + schemas + metadata.

Add WASM build to release workflow.

@deven96
deven96 requested a review from Iamdavidonuh July 20, 2026 00:23
@deven96
deven96 force-pushed the wasm-db branch 2 times, most recently from e94e804 to e00cec6 Compare July 20, 2026 00:57
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

Test Results

125 tests   125 ✅  5m 47s ⏱️
 29 suites    0 💤
  3 files      0 ❌

Results for commit 079f906.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

Benchmark Results

group                                                        main                                   pr
-----                                                        ----                                   --
predicate_query_with_index/size_100                          1.00      3.2±0.01µs        ? ?/sec    1.03      3.3±0.00µs        ? ?/sec
predicate_query_with_index/size_1000                         1.00     31.8±0.01µs        ? ?/sec    1.00     31.6±0.02µs        ? ?/sec
predicate_query_with_index/size_10000                        1.08    418.8±0.30µs        ? ?/sec    1.00    387.5±0.19µs        ? ?/sec
predicate_query_with_index/size_100000                       1.00      5.9±0.06ms        ? ?/sec    1.00      5.9±0.24ms        ? ?/sec
predicate_query_without_index/size_100                       1.00      6.8±0.02µs        ? ?/sec    1.00      6.8±0.01µs        ? ?/sec
predicate_query_without_index/size_1000                      1.00     80.5±0.16µs        ? ?/sec    1.02     81.8±0.92µs        ? ?/sec
predicate_query_without_index/size_10000                     1.00    680.7±4.35µs        ? ?/sec    1.02    696.0±4.54µs        ? ?/sec
predicate_query_without_index/size_100000                    1.00     14.9±0.17ms        ? ?/sec    1.02     15.3±0.23ms        ? ?/sec
store_batch_insertion_without_predicates/size_100            1.00    235.9±1.32µs        ? ?/sec    1.00    234.7±1.71µs        ? ?/sec
store_batch_insertion_without_predicates/size_1000           1.00   1422.3±7.95µs        ? ?/sec    1.01   1434.2±7.69µs        ? ?/sec
store_batch_insertion_without_predicates/size_10000          1.00     14.2±0.19ms        ? ?/sec    1.02     14.4±0.10ms        ? ?/sec
store_batch_insertion_without_predicates/size_100000         1.00    150.5±8.36ms        ? ?/sec    1.00   150.9±10.22ms        ? ?/sec
store_retrieval_linear_cosine_similarity/size_100            1.01     29.7±0.33µs        ? ?/sec    1.00     29.4±0.29µs        ? ?/sec
store_retrieval_linear_cosine_similarity/size_1000           1.00    151.6±0.43µs        ? ?/sec    1.02    154.8±0.76µs        ? ?/sec
store_retrieval_linear_cosine_similarity/size_10000          1.00  1623.5±12.66µs        ? ?/sec    1.03  1670.2±30.07µs        ? ?/sec
store_retrieval_linear_cosine_similarity/size_100000         1.00     23.7±0.13ms        ? ?/sec    1.02     24.2±0.10ms        ? ?/sec
store_retrieval_linear_dot_product/size_100                  1.00     29.3±0.16µs        ? ?/sec    1.00     29.2±0.22µs        ? ?/sec
store_retrieval_linear_dot_product/size_1000                 1.00    147.5±0.38µs        ? ?/sec    1.01    148.9±0.69µs        ? ?/sec
store_retrieval_linear_dot_product/size_10000                1.00  1441.6±13.02µs        ? ?/sec    1.03  1487.6±29.00µs        ? ?/sec
store_retrieval_linear_dot_product/size_100000               1.00     22.3±0.14ms        ? ?/sec    1.02     22.8±0.21ms        ? ?/sec
store_retrieval_linear_euclidean_distance/size_100           1.01     29.4±0.18µs        ? ?/sec    1.00     29.0±0.18µs        ? ?/sec
store_retrieval_linear_euclidean_distance/size_1000          1.01    149.4±0.54µs        ? ?/sec    1.00    148.4±0.81µs        ? ?/sec
store_retrieval_linear_euclidean_distance/size_10000         1.01   1522.7±8.74µs        ? ?/sec    1.00  1513.7±11.26µs        ? ?/sec
store_retrieval_linear_euclidean_distance/size_100000        1.00     22.7±0.18ms        ? ?/sec    1.03     23.3±0.40ms        ? ?/sec
store_retrieval_no_condition/size_100                        1.01     29.8±0.22µs        ? ?/sec    1.00     29.4±0.13µs        ? ?/sec
store_retrieval_no_condition/size_1000                       1.01    152.7±0.36µs        ? ?/sec    1.00    150.9±1.14µs        ? ?/sec
store_retrieval_no_condition/size_10000                      1.00   1579.3±8.30µs        ? ?/sec    1.02  1607.4±10.84µs        ? ?/sec
store_retrieval_no_condition/size_100000                     1.00     23.2±0.23ms        ? ?/sec    1.00     23.2±0.20ms        ? ?/sec
store_retrieval_non_linear_hnsw/size_100                     1.00    152.6±0.73µs        ? ?/sec    1.00    152.7±0.81µs        ? ?/sec
store_retrieval_non_linear_hnsw/size_1000                    1.00    351.1±1.58µs        ? ?/sec    1.03    360.1±2.39µs        ? ?/sec
store_retrieval_non_linear_hnsw/size_10000                   1.00    524.4±2.06µs        ? ?/sec    1.01    530.0±3.16µs        ? ?/sec
store_retrieval_non_linear_hnsw/size_100000                  1.00    679.8±1.92µs        ? ?/sec    1.01    689.0±1.57µs        ? ?/sec
store_retrieval_non_linear_kdtree/size_100                   1.00    167.7±0.51µs        ? ?/sec    1.00    167.7±0.51µs        ? ?/sec
store_retrieval_non_linear_kdtree/size_1000                  1.00   1087.9±1.11µs        ? ?/sec    1.00   1086.4±1.79µs        ? ?/sec
store_retrieval_non_linear_kdtree/size_10000                 1.00     11.4±0.08ms        ? ?/sec    1.00     11.4±0.11ms        ? ?/sec
store_retrieval_non_linear_kdtree/size_100000                1.00    134.4±0.32ms        ? ?/sec    1.00    134.4±0.15ms        ? ?/sec
store_sequential_insertion_without_predicates/size_100       1.02    272.9±1.34µs        ? ?/sec    1.00    268.6±0.42µs        ? ?/sec
store_sequential_insertion_without_predicates/size_1000      1.01      2.7±0.00ms        ? ?/sec    1.00      2.7±0.00ms        ? ?/sec
store_sequential_insertion_without_predicates/size_10000     1.01     27.1±0.02ms        ? ?/sec    1.00     26.9±0.02ms        ? ?/sec
store_sequential_insertion_without_predicates/size_100000    1.01    272.5±0.38ms        ? ?/sec    1.00    270.0±0.20ms        ? ?/sec

@deven96
deven96 force-pushed the wasm-db branch 4 times, most recently from b2985fd to 9db6465 Compare July 20, 2026 19:26
- Make db crate WASM-compatible via conditional compilation
- Add wasm-db crate with 9 protobuf API methods
- Implement snapshot export/import using MessagePack
- Add comprehensive Node.js test suite (9 tests)
- Integrate WASM tests into CI with JUnit output
- Add WASM build to GitHub release workflow
- Sequential execution only (no parallelism in browser)
- SIMD support via pulp for 2-4x speedup
- Performance: 125k inserts/sec, 2-5ms similarity search

@jimezesinachi jimezesinachi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly, LGTM, just a minor rewrite to prevent future drift between the operations.rs and handler.rs impls

Comment thread ahnlich/db/src/engine/operations.rs
Comment thread ahnlich/db/src/engine/operations.rs
Comment thread ahnlich/db/src/engine/operations.rs
Comment thread ahnlich/db/src/engine/operations.rs
Comment thread ahnlich/db/src/engine/operations.rs

@jimezesinachi jimezesinachi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@deven96
deven96 force-pushed the wasm-db branch 3 times, most recently from d588a98 to 68cd69c Compare July 23, 2026 14:29
@deven96
deven96 merged commit 715f1d1 into main Jul 23, 2026
4 of 5 checks passed
@deven96
deven96 deleted the wasm-db branch July 23, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants