From d4aed8145b5478d62308319d2ad849e2a1e371db Mon Sep 17 00:00:00 2001 From: Ivan Boldyrev Date: Sat, 9 Sep 2023 23:45:31 +0400 Subject: Wasm32 SIMD implementation This code is based on rust_sse2.rs of the same distribution, and is subject to further improvements. Some comments are left intact even if their applicability is questioned. SIMD implementation is gated by `wasm32-simd` feature, portable version is used otherwise. Performance measurements with a primitive benchmark with ~16Kb of data: | M1 native | 11,610 ns | | M1 WASM SIMD | 13,355 ns | | M1 WASM | 22,037 ns | | x64 native | 6,713 ns | | x64 WASM SIMD | 11,985 ns | | x64 WASM | 25,978 ns | wasmtime v12.0.1 was used on both platforms. Closes #187. --- Cargo.toml | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Cargo.toml') diff --git a/Cargo.toml b/Cargo.toml index 11779d1..9436937 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,11 @@ default = ["std"] # implementation uses C intrinsics and requires a C compiler. neon = [] +# The WASM-SIMD implementation does not participate in dynamic feature detection, +# which is currently x86-only. If "wasm_simd" is on, WASM SIMD support is assumed. +# Note that not all WASM implementation may support WASM-SIMD specification. +wasm32_simd = [] + # This crate uses libstd for std::io trait implementations, and also for # runtime CPU feature detection. This feature is enabled by default. If you use # --no-default-features, the only way to use the SIMD implementations in this -- cgit v1.2.3