Skip to content

Add WASM support - #18

Merged
alexvbrdn merged 2 commits into
mainfrom
add-wasm-support
Sep 14, 2026
Merged

alexvbrdn merged 2 commits into
mainfrom
add-wasm-support

Conversation

@alexvbrdn

Copy link
Copy Markdown
Member

What this changes

This PR introduces comprehensive support for the wasm32-unknown-unknown target and resolves a shuffling limitation on 32-bit architectures.

WASM Support & Fixes:

  • ahash without getrandom: On wasm32-unknown-unknown, ahash now uses the compile-time-rng feature. This drops the getrandom dependency (which requires a backend opt-in on WASM), allowing the crate to build out-of-the-box. (Closes make ahash optional #17)
  • Removed rayon on WASM: Since WASM lacks native threads, rayon only ran its single-thread fallback. It is no longer a dependency on WASM targets. FastAutomaton::union_all_par and FastAutomaton::intersection_all_par are excluded on WASM, while keeping the parallel feature harmless if enabled by another crate in the dependency graph.
  • Customizable Execution Clock: Added ExecutionProfileBuilder::clock, ExecutionProfile::with_clock, and execution_profile::Clock. This allows WASM hosts to supply their own monotonic clock (e.g., performance.now()) to prevent timeouts from panicking on Instant::now, while also enabling fully deterministic timeout testing across all targets.

32-bit Fix:

  • 64-bit Shuffling Window: Fixed a bug on 32-bit targets (wasm32, i686, armv7, etc.) where CharacterOrder::Shuffled and PathOrder::Shuffled were restricted to 2^32 combinations due to usize indexing. The window is now strictly 64-bit on all targets.

Checklist

  • cargo fmt --all --check and cargo clippy --all-targets -- -D warnings pass
  • cargo test and cargo test --no-default-features pass
  • New public items are documented
  • A test covers the change
  • CHANGELOG.md is updated under ## [Unreleased]
  • The change builds on Rust 1.88, or the MSRV bump is intentional and noted

@alexvbrdn alexvbrdn self-assigned this Sep 14, 2026
@alexvbrdn
alexvbrdn merged commit b413679 into main Sep 14, 2026
8 checks passed
@alexvbrdn
alexvbrdn deleted the add-wasm-support branch September 14, 2026 17:49
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.

1 participant