#!/usr/bin/env bash # SPDX-License-Identifier: MIT # SH-2 instructions per second, one core: sh2-python's benchmarks/harness_speed.py loop # (src/bench.rs), the release build natively (sh2-bench: best of RUNS by wall and by # thread CPU time) and, when the wasm32-unknown-unknown target and node are present, the # wasm32 build under Node (scripts/wasm_bench.mjs). Reported, not a gate. # STEPS (default 20,000,000), RUNS (default 5) set -euo pipefail source "$(dirname "$0")/env.sh" STEPS=${STEPS:-20000000}; RUNS=${RUNS:-5} build for cache in "" --cache "--32x" "--32x --cache"; do nice -n 0 "$ROOT/target/release/sh2-bench" --steps "$STEPS" --runs "$RUNS" $cache done if command -v node > /dev/null && [ -d "$STABLE/../lib/rustlib/wasm32-unknown-unknown" ]; then PATH="$STABLE:$PATH" nice -n 19 cargo build --release -q -j "$JOBS" --lib --no-default-features \ --target wasm32-unknown-unknown --manifest-path "$ROOT/Cargo.toml" node "$ROOT/scripts/wasm_bench.mjs" "$ROOT/target/wasm32-unknown-unknown/release/sh2.wasm" "$STEPS" "$RUNS" else echo "wasm: no wasm32-unknown-unknown target or no node (skipped)" fi