You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(benchmark): optimize SLOAD/SSTORE benchmarks per review feedback
Address review comments by optimizing loop efficiency:
1. Move function selector MSTORE outside loops (Comment #2)
- BALANCEOF_SELECTOR and APPROVE_SELECTOR now stored once per contract
- Saves 3 gas (G_VERY_LOW) per iteration
- Total savings: ~6,471 gas for 50-50 ratio with 10M budget and 3 contracts
2. Remove unused return data from CALL operations (Comment #1)
- Changed ret_offset=96/128, ret_size=32 to ret_offset=0, ret_size=0
- Eliminates unnecessary memory expansion
- Minor gas savings, cleaner implementation
Skipped Comment #3 (use Op.GAS for addresses):
- Would lose determinism (GAS varies per iteration)
- Adds complexity for minimal benefit
- Counter still needed for loop control
Changes applied to:
- test_sload_empty_erc20_balanceof
- test_sstore_erc20_approve
- test_mixed_sload_sstore (both SLOAD and SSTORE loops)
0 commit comments