Skip to content

[Goal #349] Add Rust/WASM acceleration coverage for core functions#356

Merged
mrjf merged 1 commit into
mainfrom
goal/349-goal-add-rust-wasm-acceleration-coverage-for-core-functions
Jun 27, 2026
Merged

[Goal #349] Add Rust/WASM acceleration coverage for core functions#356
mrjf merged 1 commit into
mainfrom
goal/349-goal-add-rust-wasm-acceleration-coverage-for-core-functions

Conversation

@mrjf

@mrjf mrjf commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Goal

Add a Rust/WASM acceleration layer for eligible tsb core functions, without replacing the TypeScript implementations.

Closes #349
Refs #355

What Changed

  • Adds a Rust crate under rust/ for searchsorted and natural-sort kernels.
  • Adds prebuilt Node-targeted WASM output under rust/pkg/.
  • Adds TypeScript WASM loader/glue in src/wasm/ with TypeScript fallbacks.
  • Adds wasm-coverage.json covering 121 core entries: 6 rust-wasm, 115 ts-only-ineligible, 0 unclassified.
  • Adds 35 WASM parity tests and a benchmark runner/result artifact.
  • Adds package scripts for wasm build/test/coverage/benchmark workflows.

Verification

  • PATH="$HOME/.bun/bin:$PATH" ~/.bun/bin/bun run wasm:test
  • PATH="$HOME/.bun/bin:$PATH" ~/.bun/bin/bun run wasm:coverage
  • PATH="$HOME/.bun/bin:$PATH" ~/.bun/bin/bun run typecheck
  • PATH="$HOME/.bun/bin:$PATH" ~/.bun/bin/bun run lint exits 0 with existing warnings
  • PATH="$HOME/.bun/bin:$PATH" ~/.bun/bin/bun run bench:wasm-core

Note

Goal run 28274237232 produced this patch successfully, but Safe Outputs created fallback issue #355 instead of a PR because package.json is protected for workflow-created PRs. This PR applies that artifact manually from an authorized local environment.

…sort

- Add Rust crate (rust/) with searchsorted and natsort implementations
  - searchsorted_f64, searchsorted_many_f64, argsort_f64 (float64, NaN-last)
  - searchsorted_str, searchsorted_many_str, argsort_str (lexicographic)
  - nat_compare, nat_sorted, nat_argsort (natural sort with ignoreCase/reverse)
  - 15 Rust unit tests all passing
- Build WASM via wasm-pack --target nodejs to rust/pkg/
- Add TypeScript glue layer (src/wasm/)
  - types.ts: TsbWasmModule interface (authoritative API contract)
  - loader.ts: lazy WASM loader via createRequire; isTsbWasmModule type guard
  - accelerated.ts: public wrappers with TS fallbacks for all 6 functions
  - index.ts: public module index
- Add wasm-coverage.json: 121-entry manifest (6 rust-wasm, 115 ts-only-ineligible,
  0 unclassified, 0 eligible_missing)
- Add tests/wasm/parity.test.ts: 35 parity tests (all pass)
- Add benchmarks/wasm-core/run.ts + results-wasm-core.json
- Add scripts/wasm-coverage-check.ts: manifest validator
- Add package.json scripts: wasm:build, wasm:test, wasm:coverage, bench:wasm-core
- Update biome.json to ignore rust/ and scripts/ directories

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@mrjf mrjf merged commit 021ad54 into main Jun 27, 2026
19 checks passed
@mrjf mrjf deleted the goal/349-goal-add-rust-wasm-acceleration-coverage-for-core-functions branch June 27, 2026 15:03
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.

[Goal] Add Rust/WASM acceleration coverage for core functions

1 participant