Skip to content

Commit f6027eb

Browse files
chore: new benchmark suite with coremark
Signed-off-by: Henry <mail@henrygressmann.de>
1 parent b45a98a commit f6027eb

54 files changed

Lines changed: 845 additions & 864 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.cargo/config.toml‎

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
[alias]
2-
version-dev="workspaces version --no-git-commit --force tinywasm*"
3-
test-wasm-1="test --package tinywasm --test test-wasm-1 --release"
4-
test-wasm-2="test --package tinywasm --test test-wasm-2 --release"
5-
test-wasm-3="test --package tinywasm --test test-wasm-3 --release"
6-
test-wast="test --package tinywasm --test test-wast"
7-
test-wasm-custom="test --package tinywasm --test test-wasm-custom --release"
8-
cli="run -p tinywasm-cli --bin tinywasm --release --"
9-
doom="run --manifest-path ./examples/doom/Cargo.toml --release --"
2+
bench-suite = "bench -p bench --bench suite --"
3+
cli = "run -p tinywasm-cli --bin tinywasm --release --"
4+
coremark = "run --release -p bench -- coremark"
5+
doom = "run --manifest-path ./examples/doom/Cargo.toml --release --"
6+
test-wasm-1 = "test --package tinywasm --test test-wasm-1 --release"
7+
test-wasm-2 = "test --package tinywasm --test test-wasm-2 --release"
8+
test-wasm-3 = "test --package tinywasm --test test-wasm-3 --release"
9+
test-wasm-custom = "test --package tinywasm --test test-wasm-custom --release"
10+
test-wast = "test --package tinywasm --test test-wast"
11+
version-dev = "workspaces version --no-git-commit --force tinywasm*"
1012

1113
[target.x86_64-unknown-linux-gnu]
12-
rustflags=["-C", "target-cpu=x86-64-v3"]
14+
rustflags = ["-C", "target-cpu=x86-64-v3"]

‎.github/workflows/test.yaml‎

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -12,42 +12,7 @@ permissions:
1212
contents: read
1313

1414
jobs:
15-
build-wasm:
16-
name: Build wasm
17-
runs-on: ubuntu-latest
18-
steps:
19-
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
20-
with:
21-
submodules: true
22-
persist-credentials: false
23-
- name: Install Rust toolchain
24-
uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0
25-
with:
26-
toolchain: nightly
27-
components: rust-src
28-
rustflags: ""
29-
target: wasm32-unknown-unknown
30-
- name: Install Binaryen
31-
run: |
32-
BINARYEN_VERSION=version_129
33-
BINARYEN_DIR="binaryen-${BINARYEN_VERSION}"
34-
BINARYEN_ARCHIVE="${BINARYEN_DIR}-x86_64-linux.tar.gz"
35-
curl -L "https://github.com/WebAssembly/binaryen/releases/download/${BINARYEN_VERSION}/${BINARYEN_ARCHIVE}" -o "/tmp/${BINARYEN_ARCHIVE}"
36-
echo "50b9fa62b9abea752da92ec57e0c555fee578760cd237c40107957715d2976ba /tmp/${BINARYEN_ARCHIVE}" | sha256sum -c -
37-
tar -xzf "/tmp/${BINARYEN_ARCHIVE}" -C /tmp
38-
sudo install "/tmp/${BINARYEN_DIR}/bin/wasm-opt" /usr/local/bin/wasm-opt
39-
- name: Install WABT
40-
run: sudo apt-get install -y wabt
41-
- name: Build wasm
42-
run: ./examples/rust/build.sh
43-
- name: Save artifacts
44-
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
45-
with:
46-
name: wasm
47-
path: examples/rust/out
48-
4915
run-tests:
50-
needs: build-wasm
5116
strategy:
5217
matrix:
5318
include:
@@ -102,12 +67,6 @@ jobs:
10267
components: rustfmt, clippy
10368
if: matrix.target == ''
10469

105-
- name: Load wasm
106-
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
107-
with:
108-
name: wasm
109-
path: examples/rust/out
110-
11170
- name: Run tests
11271
run: cargo test --workspace ${{ matrix.args }} && cargo test --workspace ${{ matrix.args }} --examples
11372
if: matrix.target == ''

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/target
2+
/crates/bench/guest/target
23
notes.md
34
examples/*/out/*
45
examples/*/target

‎CONTRIBUTING.md‎

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ cargo fmt --all -- --check
2323
cargo clippy --workspace
2424
cargo test --workspace
2525
cargo run --example basic
26-
cargo bench --bench tinywasm
26+
cargo bench-suite
2727
```
2828

2929
WebAssembly test commands:
@@ -38,18 +38,11 @@ cargo test-wast crates/tinywasm/tests/wasm-custom/table-basics.wast
3838

3939
Set `RUST_LOG=debug` when running `cargo test-wast` to see executor debug logs.
4040

41-
The `rust` example requires the `wasm32-unknown-unknown` target, the `rust-src` component, [Binaryen](https://github.com/WebAssembly/binaryen), and [WABT](https://github.com/WebAssembly/wabt):
42-
43-
```bash
44-
./examples/rust/build.sh
45-
cargo run --example rust -- hello
46-
```
47-
4841
You can use [samply](https://github.com/mstange/samply/) for profiling:
4942

5043
```bash
5144
cargo install --locked samply
52-
samply record -- cargo run --profile samply --example rust -- tinywasm
45+
samply record -- cargo bench-suite execute/nested_tinywasm
5346
```
5447

5548
Keep changes focused and external dependencies to a minimum. Update public documentation, the README, and the unreleased changelog when applicable.

‎Cargo.lock‎

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,9 @@ unused_dependencies = "allow" # false-positive on libm
4545
[workspace.lints.rust]
4646
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(rust_analyzer)"] }
4747

48-
[[example]]
49-
name = "rust"
50-
test = false
51-
52-
[[bench]]
53-
harness = false
54-
name = "argon2id"
55-
56-
[[bench]]
57-
harness = false
58-
name = "fibonacci"
59-
60-
[[bench]]
61-
harness = false
62-
name = "tinywasm"
63-
64-
[[bench]]
65-
harness = false
66-
name = "tinywasm_modes"
67-
6848
[dev-dependencies]
6949
anyhow.workspace = true
70-
criterion.workspace = true
71-
pretty_env_logger.workspace = true
7250
tinywasm = { path = "crates/tinywasm", features = ["state"] }
73-
tinywasm-parser.workspace = true
7451
tinywasm-wasi.workspace = true
7552
wat.workspace = true
7653

‎README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ TinyWasm generally implements non-JavaScript core proposals at [phase 4](https:/
112112
🚧 -- in development/partially supported\
113113
🟢 -- fully supported
114114

115+
## Benchmarks
116+
117+
Tinywasm includes a small benchmark suite at [`crates/bench`](crates/bench) that runs a set of WebAssembly modules and measures execution time. For comparisons with other runtimes, check out the great [wasmi-benchmarks](https://github.com/wasmi-labs/wasmi-benchmarks) repository.
118+
115119
## See Also
116120

117121
If you're looking for a WebAssembly runtime with JIT compilation, better performance or other advanced features, check out these other runtimes:

‎benches/argon2id.rs‎

Lines changed: 0 additions & 46 deletions
This file was deleted.

‎benches/fibonacci.rs‎

Lines changed: 0 additions & 52 deletions
This file was deleted.

‎benches/tinywasm.rs‎

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)