Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions benchmarks/all.suite
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 10 additions & 2 deletions benchmarks/libsodium/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 4 additions & 17 deletions benchmarks/libsodium/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion benchmarks/libsodium/libsodium-aead_aes256gcm.input

This file was deleted.

Binary file removed benchmarks/libsodium/libsodium-aead_aes256gcm.wasm
Binary file not shown.
1 change: 0 additions & 1 deletion benchmarks/libsodium/libsodium-aead_aes256gcm2.input

This file was deleted.

Binary file not shown.
1 change: 0 additions & 1 deletion benchmarks/libsodium/libsodium-misuse.input

This file was deleted.

Binary file removed benchmarks/libsodium/libsodium-misuse.wasm
Binary file not shown.
1 change: 0 additions & 1 deletion benchmarks/libsodium/libsodium-onetimeauth2.input

This file was deleted.

Binary file removed benchmarks/libsodium/libsodium-onetimeauth2.wasm
Binary file not shown.
1 change: 0 additions & 1 deletion benchmarks/libsodium/libsodium-sodium_core.input

This file was deleted.

Binary file removed benchmarks/libsodium/libsodium-sodium_core.wasm
Binary file not shown.
1 change: 0 additions & 1 deletion benchmarks/libsodium/libsodium-sodium_version.input

This file was deleted.

Binary file removed benchmarks/libsodium/libsodium-sodium_version.wasm
Binary file not shown.
6 changes: 0 additions & 6 deletions benchmarks/simd.suite
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading