Implement Yul to LLVM IR compilation benchmarks (#407)

# Description

Closes [#404](https://github.com/paritytech/revive/issues/404)

Adds compilation time benchmarks for:

* Parsing of Yul source code -> AST Object
* Lowering of AST Object -> LLVM IR (unoptimized)

The benchmarks can be run from the root via:

```sh
# Run all benchmarks in the revive-yul crate (parsing + lowering)
make bench-yul
```

HTML reports will be generated under `target/criterion`, and a summary
of the results at
[crates/yul/BENCHMARKS_PARSE_M4PRO.md](https://github.com/paritytech/revive/blob/lj/compilation-benchmarks-yul/crates/yul/BENCHMARKS_PARSE_M4PRO.md)
and
[crates/yul/BENCHMARKS_LOWER_M4PRO.md](https://github.com/paritytech/revive/blob/lj/compilation-benchmarks-yul/crates/yul/BENCHMARKS_LOWER_M4PRO.md)
(currently from running on a Mac M4 Pro).

---------

Co-authored-by: xermicus <cyrill@parity.io>
This commit is contained in:
LJ
2025-11-25 12:00:06 +01:00
committed by GitHub
parent 1e0cce0fa8
commit 0742227c5a
12 changed files with 425 additions and 24 deletions
+13 -2
View File
@@ -14,6 +14,7 @@
test \
test-integration \
test-resolc \
test-yul \
test-workspace \
test-wasm \
test-llvm-builder \
@@ -21,6 +22,7 @@
bench-pvm \
bench-evm \
bench-resolc \
bench-yul \
clean
install: install-bin install-npm
@@ -67,10 +69,13 @@ test-integration: install-bin
cargo test --package revive-integration
test-resolc: install
cargo test --package resolc --benches
cargo test --package resolc --all-targets
test-yul:
cargo test --package revive-yul --all-targets
test-workspace: install
cargo test --workspace --exclude revive-llvm-builder
cargo test --workspace --all-targets --exclude revive-llvm-builder
test-wasm: install-wasm
npm run test:wasm
@@ -95,6 +100,12 @@ bench-resolc: test-resolc
cargo criterion --package resolc --bench compile --message-format=json \
| criterion-table > crates/resolc/BENCHMARKS_M4PRO.md
bench-yul: test-yul
cargo criterion --package revive-yul --bench parse --message-format=json \
| criterion-table > crates/yul/BENCHMARKS_PARSE_M4PRO.md
cargo criterion --package revive-yul --bench lower --message-format=json \
| criterion-table > crates/yul/BENCHMARKS_LOWER_M4PRO.md
clean:
cargo clean ; \
revive-llvm clean ; \