diff --git a/benchmarks/all.suite b/benchmarks/all.suite index e62a0af7..71d77c87 100644 --- a/benchmarks/all.suite +++ b/benchmarks/all.suite @@ -16,8 +16,6 @@ intgemm-simd/benchmark.wasm kotlin-richards/kotlin-richards.wasm libsodium/libsodium-aead_aegis128l.wasm libsodium/libsodium-aead_aegis256.wasm -libsodium/libsodium-aead_aes256gcm.wasm -libsodium/libsodium-aead_aes256gcm2.wasm libsodium/libsodium-aead_chacha20poly1305.wasm libsodium/libsodium-aead_chacha20poly13052.wasm libsodium/libsodium-aead_xchacha20poly1305.wasm @@ -56,9 +54,7 @@ libsodium/libsodium-kdf_hkdf.wasm libsodium/libsodium-keygen.wasm libsodium/libsodium-kx.wasm libsodium/libsodium-metamorphic.wasm -libsodium/libsodium-misuse.wasm libsodium/libsodium-onetimeauth.wasm -libsodium/libsodium-onetimeauth2.wasm libsodium/libsodium-onetimeauth7.wasm libsodium/libsodium-pwhash_argon2i.wasm libsodium/libsodium-pwhash_argon2id.wasm @@ -83,9 +79,7 @@ libsodium/libsodium-secretstream_xchacha20poly1305.wasm libsodium/libsodium-shorthash.wasm libsodium/libsodium-sign.wasm libsodium/libsodium-siphashx24.wasm -libsodium/libsodium-sodium_core.wasm libsodium/libsodium-sodium_utils.wasm -libsodium/libsodium-sodium_version.wasm libsodium/libsodium-stream.wasm libsodium/libsodium-stream2.wasm libsodium/libsodium-stream3.wasm diff --git a/benchmarks/libsodium/Dockerfile b/benchmarks/libsodium/Dockerfile index 6944b077..34da3f97 100644 --- a/benchmarks/libsodium/Dockerfile +++ b/benchmarks/libsodium/Dockerfile @@ -42,9 +42,17 @@ RUN zig build -Dtarget=wasm32-wasi \ -Doptimize=ReleaseFast -Dcpu=generic+bulk_memory+simd128 \ -Denable_benchmarks=true -Diterations=1 -# Place all of the WebAssembly benchmarks in `/benchmark`. Some benchmarks lose -# the `bench_end` import for some reason and are removed (TODO). +# Place all of the WebAssembly benchmarks in `/benchmark`. WORKDIR /benchmark RUN cp /libsodium/zig-out/bin/*.wasm . RUN for f in *.wasm; do mv "$f" "libsodium-$f"; done + +# These benchmarks lose the `bench_end` import for some reason. RUN rm libsodium-sodium_utils2.wasm libsodium-sodium_utils3.wasm + +# These tests do no measurable work once compiled to Wasm -- their bodies are guarded by +# host-feature checks that are false on Wasm, or are empty after preprocessing -- so they +# measure nothing but harness overhead no matter how many iterations they run. +RUN rm libsodium-aead_aes256gcm.wasm libsodium-aead_aes256gcm2.wasm \ + libsodium-misuse.wasm libsodium-onetimeauth2.wasm \ + libsodium-sodium_core.wasm libsodium-sodium_version.wasm diff --git a/benchmarks/libsodium/README.md b/benchmarks/libsodium/README.md index d0e1c868..3d046ede 100644 --- a/benchmarks/libsodium/README.md +++ b/benchmarks/libsodium/README.md @@ -46,8 +46,10 @@ new libsodium release. ## Status -45 of the 78 tests are within the 80M-120M band described in [../README.md](../README.md). -The rest cannot get there with an iteration count as the only lever. +Six of upstream's 78 tests are deleted rather than tuned, as they compile down +to empty functions when targeting Wasm, leaving 72. 45 of those are within the +80M-120M band described in [../README.md](../README.md). The rest cannot get +there with an iteration count as the only lever. ### Over the band even at one iteration (27) @@ -71,21 +73,6 @@ integer iteration count that lands in the band. | `stream` | 1.12G | `onetimeauth7` | 131.6M | | `stream2` | 1.03G | | | -### No measurable work on Wasm (6) - -These bodies are empty or near-empty once compiled to Wasm, so no iteration count can -reach the band. They are left at 1 iteration rather than padded with a loop that would -measure nothing but loop overhead. - -| test | instructions | why | -| --- | --- | --- | -| `aead_aes256gcm` | 65 | Guarded by `crypto_aead_aes256gcm_is_available()`, which is false on Wasm. | -| `aead_aes256gcm2` | 27 | Same AES-NI availability check as `aead_aes256gcm`. | -| `misuse` | 0 | Its body is `#ifdef HAVE_CATCHABLE_ABRT`, and `build.zig` only defines that for Linux and macOS, so on Wasm the test is just `return 0`. | -| `onetimeauth2` | 0 | Its only statement is `printf("%d\n", crypto_onetimeauth_verify(...))`, and `cmptest.h` defines `printf(...)` to `do { } while(0)` — so the argument is never evaluated and the verify never runs. | -| `sodium_core` | 236 | Only runtime CPU feature detection, all false on Wasm. | -| `sodium_version` | 25 | Only version-string getters. | - ### Not deterministic (7) These seed libsodium's RNG from the OS (WASI `random_get`) and then size their work from diff --git a/benchmarks/libsodium/libsodium-aead_aes256gcm.input b/benchmarks/libsodium/libsodium-aead_aes256gcm.input deleted file mode 100644 index d00491fd..00000000 --- a/benchmarks/libsodium/libsodium-aead_aes256gcm.input +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/benchmarks/libsodium/libsodium-aead_aes256gcm.wasm b/benchmarks/libsodium/libsodium-aead_aes256gcm.wasm deleted file mode 100755 index 372b1571..00000000 Binary files a/benchmarks/libsodium/libsodium-aead_aes256gcm.wasm and /dev/null differ diff --git a/benchmarks/libsodium/libsodium-aead_aes256gcm2.input b/benchmarks/libsodium/libsodium-aead_aes256gcm2.input deleted file mode 100644 index d00491fd..00000000 --- a/benchmarks/libsodium/libsodium-aead_aes256gcm2.input +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/benchmarks/libsodium/libsodium-aead_aes256gcm2.wasm b/benchmarks/libsodium/libsodium-aead_aes256gcm2.wasm deleted file mode 100755 index 0ad1c138..00000000 Binary files a/benchmarks/libsodium/libsodium-aead_aes256gcm2.wasm and /dev/null differ diff --git a/benchmarks/libsodium/libsodium-misuse.input b/benchmarks/libsodium/libsodium-misuse.input deleted file mode 100644 index d00491fd..00000000 --- a/benchmarks/libsodium/libsodium-misuse.input +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/benchmarks/libsodium/libsodium-misuse.wasm b/benchmarks/libsodium/libsodium-misuse.wasm deleted file mode 100755 index 8b2d059a..00000000 Binary files a/benchmarks/libsodium/libsodium-misuse.wasm and /dev/null differ diff --git a/benchmarks/libsodium/libsodium-onetimeauth2.input b/benchmarks/libsodium/libsodium-onetimeauth2.input deleted file mode 100644 index d00491fd..00000000 --- a/benchmarks/libsodium/libsodium-onetimeauth2.input +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/benchmarks/libsodium/libsodium-onetimeauth2.wasm b/benchmarks/libsodium/libsodium-onetimeauth2.wasm deleted file mode 100755 index 66918fc6..00000000 Binary files a/benchmarks/libsodium/libsodium-onetimeauth2.wasm and /dev/null differ diff --git a/benchmarks/libsodium/libsodium-sodium_core.input b/benchmarks/libsodium/libsodium-sodium_core.input deleted file mode 100644 index d00491fd..00000000 --- a/benchmarks/libsodium/libsodium-sodium_core.input +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/benchmarks/libsodium/libsodium-sodium_core.wasm b/benchmarks/libsodium/libsodium-sodium_core.wasm deleted file mode 100755 index 38a43c83..00000000 Binary files a/benchmarks/libsodium/libsodium-sodium_core.wasm and /dev/null differ diff --git a/benchmarks/libsodium/libsodium-sodium_version.input b/benchmarks/libsodium/libsodium-sodium_version.input deleted file mode 100644 index d00491fd..00000000 --- a/benchmarks/libsodium/libsodium-sodium_version.input +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/benchmarks/libsodium/libsodium-sodium_version.wasm b/benchmarks/libsodium/libsodium-sodium_version.wasm deleted file mode 100755 index e0adadf7..00000000 Binary files a/benchmarks/libsodium/libsodium-sodium_version.wasm and /dev/null differ diff --git a/benchmarks/simd.suite b/benchmarks/simd.suite index ad93de15..d27e8cd7 100644 --- a/benchmarks/simd.suite +++ b/benchmarks/simd.suite @@ -12,8 +12,6 @@ blake3-simd/benchmark.wasm hex-simd/benchmark.wasm intgemm-simd/benchmark.wasm meshoptimizer/benchmark.wasm -libsodium/libsodium-aead_aes256gcm.wasm -libsodium/libsodium-aead_aes256gcm2.wasm libsodium/libsodium-aead_chacha20poly1305.wasm libsodium/libsodium-aead_chacha20poly13052.wasm libsodium/libsodium-aead_xchacha20poly1305.wasm @@ -51,9 +49,7 @@ libsodium/libsodium-kdf.wasm libsodium/libsodium-keygen.wasm libsodium/libsodium-kx.wasm libsodium/libsodium-metamorphic.wasm -libsodium/libsodium-misuse.wasm libsodium/libsodium-onetimeauth.wasm -libsodium/libsodium-onetimeauth2.wasm libsodium/libsodium-onetimeauth7.wasm libsodium/libsodium-pwhash_argon2i.wasm libsodium/libsodium-pwhash_argon2id.wasm @@ -78,9 +74,7 @@ libsodium/libsodium-secretstream_xchacha20poly1305.wasm libsodium/libsodium-shorthash.wasm libsodium/libsodium-sign.wasm libsodium/libsodium-siphashx24.wasm -libsodium/libsodium-sodium_core.wasm libsodium/libsodium-sodium_utils.wasm -libsodium/libsodium-sodium_version.wasm libsodium/libsodium-stream.wasm libsodium/libsodium-stream2.wasm libsodium/libsodium-stream3.wasm