erigontech / silkworm

C++ implementation of the Ethereum protocol
Apache License 2.0
277 stars 63 forks source link

Performance tests #564

Open yperbasis opened 2 years ago

yperbasis commented 2 years ago

We already have a couple of somewhat niche performance tests in cmd/benchmark. However, it'd be great to have more representative performance tests that lie between microbenchmarks on one end and real execution of all main net blocks on the other. Something like executing a bunch (1000?) of some test blocks using MDBX. Ideally those test blocks should capture performance-salient features of recent main net blocks.

Such performance tests could be used, among other things, to prevent performance regressions.

greg7mdp commented 2 years ago

My idea was to execute the last 1000 blocks of the ethereum blockchain, while tracking any accessed mdbx keys, and their value the first time they are accessed. This would provide a db sufficient to execute the last 1000 blocks. It would require some code change in silkworm of course, but it shouldn't be very hard to do. Then, we can package this state, and the 1000 blocks, as json files similar to ethereum tests. We'd need to update the command to run the test to use mdbx and not in_memory_state, but that shouldn't be too hard either.