NomicFoundation / edr

An Ethereum development runtime implementation that can be reused to build new developer tools.
MIT License
57 stars 12 forks source link

Q2 Performance #212

Open Wodann opened 1 year ago

Wodann commented 7 months ago

I ran profiling on benchmarking scenarios when using a custom allocator. A summary of my findings:

Neptune Mutual

  1. edr_evm::state::trie::account::clone (77.95%)
  2. edr_evm::miner::mine_block (6.96%)

OpenZeppelin

  1. edr_evm::blockchain::local::state_at_block_number (68.82%)
  2. edr_evm::miner::mine_block (10.1%)
  3. edr_evm::state::trie::account::clone (9.5%)

Rocketpool

  1. edr_evm::blockchain::local::state_at_block_number (42.31%)
  2. edr_evm::runtime::guaranteed_dry_run (15.8%)
  3. edr_evm::blockchain::local::last_block (11.23%)
  4. edr_evm::miner::mine_block (11.07%)
  5. edr_evm::blockchain::local::block_by_number (6.53%)

Safe Contracts

  1. edr_evm::miner::mine_block (48.6%)
  2. edr_evm::runtime::guaranteed_dry_run (17.19%)
  3. edr_evm::blockchain::local::state_at_block_number (8.78%)
  4. edr_evm::blockchain::local::last_block (7.34%)

Seaport

  1. edr_evm::miner::mine_block (38.19%)
  2. edr_evm::state::trie::account::clone (19.8%)
  3. edr_evm::runtime::guaranteed_dry_run (15.28%)
  4. edr_evm::blockchain::local::last_block (9.23%)
  5. edr_evm::blockchain::local::state_at_block_number (7.66%)

Uniswap

  1. edr_evm::blockchain::local::state_at_block_number (74.19%)
  2. edr_evm::miner::mine_block (11.26%)
  3. edr_evm::state::trie::account::clone (6.68%)

Analysis

edr_evm::state::trie::account::clone and edr_evm::blockchain::local::state_at_block_number can be almost completely avoided by using a persistent data structure.

Flamegraphs

Neptune Mutual

Image

OpenZeppelin

Image

Rocketpool

Image

Safe Contracts

Image

Seaport

Image

Uniswap

Image