bluealloy / revm

Ethereum Virtual Machine written in rust that is fast and simple to use
https://bluealloy.github.io/revm/
MIT License
1.5k stars 482 forks source link

tests: migrate revme benchmarks to Criterion #1569

Open JacekGlen opened 3 weeks ago

JacekGlen commented 3 weeks ago

This PR migrates the existing revme evm --bench tool to Criterion. The benefits of doing so include:

The main motivation for this change is that the tool can be used in gas-cost-estimator project, but its purpose goes beyond it. You can learn more about the project from this short presentation, or visit the wiki Stage 4 Scope.

In the future, I'll extend the tool to run on a preloaded state, which is useful for testing scenarios with opcodes like DELEGATECALL or SLOAD.

rakita commented 3 weeks ago

There is already a cli that allows you to run bytecode in revme: https://github.com/bluealloy/revm/blob/b3f31fc6f2fa0c15f7287ac83ba608a8513ffef1/bins/revme/src/cmd.rs#L21C5-L21C25

and even has a --bench flag. https://github.com/bluealloy/revm/blob/b3f31fc6f2fa0c15f7287ac83ba608a8513ffef1/bins/revme/src/cmd/evmrunner.rs#L94-L103

rakita commented 3 weeks ago

Wouldn't mind replacing it with criterion

JacekGlen commented 3 weeks ago

There is already a cli that allows you to run bytecode in revme: https://github.com/bluealloy/revm/blob/b3f31fc6f2fa0c15f7287ac83ba608a8513ffef1/bins/revme/src/cmd.rs#L21C5-L21C25

and even has a --bench flag.

https://github.com/bluealloy/revm/blob/b3f31fc6f2fa0c15f7287ac83ba608a8513ffef1/bins/revme/src/cmd/evmrunner.rs#L94-L103

I missed that, this is cool!

I'll update my PR to use criterion in revme, as suggested. This gives much more stable results.

JacekGlen commented 2 weeks ago

Wouldn't mind replacing it with criterion

Hi @rakita , I've updates the existing revme benchmark with Criterion. Have a look at the change now, please.