Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

precompiles: Add evmone-precompiles-bench tool #765

Merged
merged 2 commits into from
Jan 4, 2024

Conversation

chfast
Copy link
Member

@chfast chfast commented Jan 2, 2024

Add new benchmarking tool evmone-precompiles-bench to compare
performance of different precompiles implementations.

@chfast
Copy link
Member Author

chfast commented Jan 2, 2024

Current results

--------------------------------------------------------------------------------------------------------------
Benchmark                                                    Time             CPU   Iterations UserCounters...
--------------------------------------------------------------------------------------------------------------
identity<evmone::state::identity_execute>                 36.1 ns         36.1 ns     19435701 gas_rate=11.0396G/s gas_used=399
ecrecover<evmone::state::ecrecover_execute>             661296 ns       661272 ns          956 gas_rate=4.53671M/s gas_used=3k
ecrecover<evmone::state::silkpre_ecrecover_execute>      45539 ns        45522 ns        15421 gas_rate=65.9026M/s gas_used=3k
ecadd<evmone::state::ecadd_execute>                      11130 ns        11128 ns        62783 gas_rate=13.4798M/s gas_used=150
ecadd<evmone::state::silkpre_ecadd_execute>               3422 ns         3421 ns       205434 gas_rate=43.8406M/s gas_used=150
ecmul<evmone::state::ecmul_execute>                     321137 ns       321050 ns         2171 gas_rate=18.6887M/s gas_used=6k
ecmul<evmone::state::silkpre_ecmul_execute>             207472 ns       207420 ns         3379 gas_rate=28.9268M/s gas_used=6k

Copy link

codecov bot commented Jan 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (570a359) 97.90% compared to head (d7181e6) 97.90%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #765   +/-   ##
=======================================
  Coverage   97.90%   97.90%           
=======================================
  Files         110      110           
  Lines       10536    10536           
=======================================
  Hits        10315    10315           
  Misses        221      221           
Flag Coverage Δ
blockchaintests 60.38% <ø> (ø)
statetests 62.35% <ø> (ø)
statetests-silkpre 26.22% <ø> (ø)
unittests 95.89% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
test/state/precompiles.cpp 90.19% <ø> (ø)
test/state/precompiles_silkpre.cpp 76.00% <ø> (ø)

@@ -43,4 +43,31 @@ bool is_precompile(evmc_revision rev, const evmc::address& addr) noexcept;

/// Executes the message to a precompiled contract (msg.code_address must be a precompile).
evmc::Result call_precompile(evmc_revision rev, const evmc_message& msg) noexcept;


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Superfluous newline here.

Consider moving the following declarations to a specialized precompiles_internal.hpp to not bloat the main API precompiles.hpp?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done as suggested.

@chfast chfast added the precompiles Related to EVM precompiles label Jan 3, 2024
Expose all `xxx_analyze()` and `xxx_execute()` functions from
the `evmone::state` library. They are usable for tests and benchmarks.

Make `EVMONE_PRECOMPILES_SILKPRE` compile definition available to
the `evmone::state`s users.
Add new benchmarking tool `evmone-precompiles-bench` to compare
performance of different precompiles implementations.
@chfast chfast merged commit c21b12d into master Jan 4, 2024
25 checks passed
@chfast chfast deleted the precompiles/benchmarks branch January 4, 2024 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
precompiles Related to EVM precompiles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants