Add Go and Rust algorithm benchmarks

This commit is contained in:
2026-11-23 06:57:31 +08:00
commit f026a77a11
14 changed files with 2101 additions and 0 deletions
+9
View File
@@ -0,0 +1,9 @@
#!/bin/sh
set -eu
cd "$(dirname "$0")"
out=../.build/wasm-fib
mkdir -p "$out"
GOOS=js GOARCH=wasm go build -trimpath -ldflags='-s -w' -o "$out/go.wasm" main.go
rustc --edition 2021 --crate-type cdylib --target wasm32-unknown-unknown \
-C opt-level=3 -C panic=abort -C strip=symbols -o "$out/rust.wasm" fib.rs
node bench.cjs "$out" "$(go env GOROOT)/lib/wasm/wasm_exec.js"