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

[WIP] perf: remove empty (no-op) HashMap values from TrieUpdates and HashedPostState #13976

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kien-rise
Copy link
Contributor

@kien-rise kien-rise commented Jan 24, 2025

This is the simplified version of #13929.

Checklist

  • Do benchmarks
  • Improve PR description

Problem

In our benchmarks, we found that insert_storage_updates is adding hundreds of thousands of empty HashMaps. The number of meaningful entries is only thousands. By removing unnecessary entries, the performance will be improved.

Solution

Avoid adding unnecessary entries.

E2E Benchmarks
"785bc168-8538d2e7-erc20-35000"
{"tps": 35001.0, "gps": 1208892408.0443406, "is_chain_lagged": false, "chain_lag_distance": 1}
"785bc168-8538d2e7-erc20-36000"
{"tps": 36001.0, "gps": 1243434143.3961585, "is_chain_lagged": false, "chain_lag_distance": 0}
"785bc168-8538d2e7-erc20-36400"
{"tps": 36401.0, "gps": 1257247094.8883495, "is_chain_lagged": false, "chain_lag_distance": 1}
"785bc168-8538d2e7-erc20-36500"
{"tps": 36501.0, "gps": 1260693706.9232643, "is_chain_lagged": false, "chain_lag_distance": 1}
"785bc168-8538d2e7-erc20-36600"
{"tps": 36601.0, "gps": 1264152458.967033, "is_chain_lagged": false, "chain_lag_distance": 1}
"785bc168-8538d2e7-erc20-36700"
{"tps": 36701.0, "gps": 1267609469.7209303, "is_chain_lagged": true, "chain_lag_distance": 3}
"785bc168-8538d2e7-erc20-36800"
{"tps": 36801.0, "gps": 1271062700.5061426, "is_chain_lagged": true, "chain_lag_distance": 3}
"785bc168-8538d2e7-erc20-37200"
{"tps": 37201.0, "gps": 1284879652.7344913, "is_chain_lagged": true, "chain_lag_distance": 4}
"785bc168-8538d2e7-erc20-37600"
{"tps": 37601.0, "gps": 1298689498.6323714, "is_chain_lagged": true, "chain_lag_distance": 4}
"785bc168-8538d2e7-erc20-38000"
{"tps": 38001.0, "gps": 1312505549.7563453, "is_chain_lagged": true, "chain_lag_distance": 6}
"785bc168-8538d2e7-erc20-44000"
{"tps": 44001.0, "gps": 1519733106.229075, "is_chain_lagged": true, "chain_lag_distance": 40}
"785bc168-8538d2e7-raw-transfer-100000"
{"tps": 70917.98574821853, "gps": 1489301229.0783849, "is_chain_lagged": true, "chain_lag_distance": 2}
"785bc168-8538d2e7-raw-transfer-62000"
{"tps": 61380.149590163935, "gps": 1289006639.2868853, "is_chain_lagged": true, "chain_lag_distance": 2}
"785bc168-8538d2e7-raw-transfer-63000"
{"tps": 62550.83054393306, "gps": 1313590953.6401675, "is_chain_lagged": false, "chain_lag_distance": 0}
"785bc168-8538d2e7-raw-transfer-65000"
{"tps": 64196.991416309014, "gps": 1348160328.695279, "is_chain_lagged": false, "chain_lag_distance": 0}
"785bc168-8538d2e7-raw-transfer-69000"
{"tps": 68050.51818181819, "gps": 1429084397.3454545, "is_chain_lagged": false, "chain_lag_distance": 1}
"785bc168-8538d2e7-raw-transfer-70000"
{"tps": 67990.69772727272, "gps": 1427828167.1454546, "is_chain_lagged": false, "chain_lag_distance": 0}
"785bc168-8538d2e7-raw-transfer-72000"
{"tps": 69915.03971962616, "gps": 1468239350.3831775, "is_chain_lagged": false, "chain_lag_distance": 1}
"785bc168-8538d2e7-raw-transfer-76000"
{"tps": 68643.54377880185, "gps": 1441537944.4147465, "is_chain_lagged": true, "chain_lag_distance": 2}
"785bc168-8538d2e7-raw-transfer-78000"
{"tps": 69454.44755244756, "gps": 1458566913.5244756, "is_chain_lagged": false, "chain_lag_distance": 1}
"785bc168-8538d2e7-raw-transfer-80000"
{"tps": 70477.3905882353, "gps": 1480048723.2705882, "is_chain_lagged": true, "chain_lag_distance": 3}
"785bc168-8538d2e7-raw-transfer-82000"
{"tps": 71027.36255924171, "gps": 1491598139.0331755, "is_chain_lagged": true, "chain_lag_distance": 3}
"785bc168-8538d2e7-raw-transfer-84000"
{"tps": 69952.23696682464, "gps": 1469020502.3033175, "is_chain_lagged": true, "chain_lag_distance": 3}
"785bc168-8538d2e7-uniswap-6580"
{"tps": 6581.0, "gps": 917313166.4229926, "is_chain_lagged": false, "chain_lag_distance": 0}
"785bc168-8538d2e7-uniswap-6590"
{"tps": 6591.0, "gps": 918700006.3924413, "is_chain_lagged": false, "chain_lag_distance": 1}
"785bc168-8538d2e7-uniswap-6600"
{"tps": 6601.0, "gps": 920100031.6195819, "is_chain_lagged": false, "chain_lag_distance": 1}
"785bc168-8538d2e7-uniswap-6610"
{"tps": 6611.0, "gps": 921483410.1694952, "is_chain_lagged": true, "chain_lag_distance": 3}
"785bc168-8538d2e7-uniswap-6620"
{"tps": 6621.0, "gps": 922882071.8124034, "is_chain_lagged": true, "chain_lag_distance": 2}
"785bc168-8538d2e7-uniswap-6700"
{"tps": 6701.0, "gps": 934018761.980563, "is_chain_lagged": true, "chain_lag_distance": 7}
"785bc168-8538d2e7-uniswap-6860"
{"tps": 6861.0, "gps": 956326845.1132205, "is_chain_lagged": true, "chain_lag_distance": 17}

@kien-rise kien-rise changed the title [WIP] perf: only perform insert_storage_updates if storage_updates is not empty [WIP] perf: get rid of empty (no-op) HashMap values in TrieUpdates and HashedPostState Jan 25, 2025
@kien-rise kien-rise changed the title [WIP] perf: get rid of empty (no-op) HashMap values in TrieUpdates and HashedPostState [WIP] perf: remove empty (no-op) HashMap values from TrieUpdates and HashedPostState Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant