-
Notifications
You must be signed in to change notification settings - Fork 82
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
dev: move pow to constants #332
Conversation
i skimmed through all the modules, lmk if i am missing any. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great thanks 🔥 just a few comments
Just for reference, here are gas costs changes: ****IMPROVEMENTS****
evm::tests::test_instructions::test_environment_information::test_codecopy_basic 2741246 --> 2141666 | -21.87 %
evm::tests::test_instructions::test_environment_information::test_codecopy_type_conversion_error 619720 --> 619700 | -0.00 %
evm::tests::test_instructions::test_environment_information::test_codecopy_with_offset 2628446 --> 2028866 | -22.81 %
evm::tests::test_instructions::test_environment_information::test_codecopy_with_out_of_bound_bytes 2962516 --> 2362936 | -20.24 %
evm::tests::test_instructions::test_environment_information::test_codecopy_with_out_of_bound_offset 2006756 --> 1992836 | -0.69 %
evm::tests::test_instructions::test_environment_information::test_returndata_copy_basic 5148972 --> 4724522 | -8.24 %
evm::tests::test_instructions::test_environment_information::test_returndata_copy_overflowing_add_error 578940 --> 574180 | -0.82 %
evm::tests::test_instructions::test_environment_information::test_returndata_copy_type_conversion_error 414980 --> 414970 | -0.00 %
evm::tests::test_instructions::test_environment_information::test_returndata_copy_with_multiple_words 5005422 --> 4580972 | -8.48 %
evm::tests::test_instructions::test_environment_information::test_returndata_copy_with_offset 5053272 --> 4628822 | -8.40 %
evm::tests::test_instructions::test_environment_information::test_returndata_copy_with_out_of_bound_bytes 578940 --> 574180 | -0.82 %
evm::tests::test_instructions::test_memory_operations::test_exec_mload_should_load_a_value_from_memory 505420 --> 496020 | -1.86 %
evm::tests::test_instructions::test_memory_operations::test_exec_mload_should_load_a_value_from_memory_with_memory_expansion 802300 --> 500070 | -37.67 %
evm::tests::test_instructions::test_memory_operations::test_exec_mload_should_load_a_value_from_memory_with_offset_larger_than_msize 806350 --> 504120 | -37.48 %
evm::tests::test_instructions::test_memory_operations::test_exec_mstore8_should_store_last_uint8_offset_31 635534 --> 630724 | -0.76 %
evm::tests::test_instructions::test_memory_operations::test_exec_mstore8_should_store_last_uint8_offset_63 928364 --> 630724 | -32.06 %
evm::tests::test_instructions::test_memory_operations::test_exec_mstore8_should_store_uint8_offset_30 635534 --> 630724 | -0.76 %
evm::tests::test_instructions::test_memory_operations::test_exec_mstore8_should_store_uint8_offset_31 635534 --> 630724 | -0.76 %
evm::tests::test_instructions::test_memory_operations::test_exec_mstore8_should_store_uint8_offset_31_then_uint8_offset_30 1022258 --> 1017438 | -0.47 %
evm::tests::test_instructions::test_memory_operations::test_exec_mstore_should_store_max_uint256_offset_0 490030 --> 480930 | -1.86 %
evm::tests::test_instructions::test_memory_operations::test_exec_mstore_should_store_max_uint256_offset_1 809300 --> 468780 | -42.08 %
evm::tests::test_memory::test__ensure_length__should_return_expanded_memory_and_cost 2449916 --> 2445106 | -0.20 %
evm::tests::test_memory::test__ensure_length__should_return_the_same_memory_and_no_cost 2449646 --> 2444836 | -0.20 %
evm::tests::test_memory::test__expand__should_return_expanded_memory_and_cost 2446246 --> 2441436 | -0.20 %
evm::tests::test_memory::test__expand__should_return_the_same_memory_and_no_cost 2445976 --> 2441166 | -0.20 %
evm::tests::test_memory::test__expand_and_load__should_return_expanded_memory_and_element_and_cost 3289776 --> 2689606 | -18.24 %
evm::tests::test_memory::test__load__should_load_an_element_from_the_memory 5473032 --> 4872952 | -10.96 %
evm::tests::test_memory::test__load__should_load_an_element_from_the_memory_with_offset_1 4988792 --> 4642922 | -6.93 %
evm::tests::test_memory::test__load__should_load_an_element_from_the_memory_with_offset_2 4984252 --> 4642922 | -6.85 %
evm::tests::test_memory::test__load__should_load_an_element_from_the_memory_with_offset_3 4990882 --> 4649552 | -6.84 %
evm::tests::test_memory::test__load__should_load_an_element_from_the_memory_with_offset_4 4967692 --> 4653602 | -6.32 %
evm::tests::test_memory::test__load__should_load_an_element_from_the_memory_with_offset_5 4987572 --> 4650022 | -6.77 %
evm::tests::test_memory::test__load__should_load_an_element_from_the_memory_with_offset_6 4944092 --> 4646442 | -6.02 %
evm::tests::test_memory::test_load_n_internal_same_word 1029570 --> 1025170 | -0.43 %
evm::tests::test_memory::test_store_n_no_aligned_words 350330 --> 350320 | -0.00 %
evm::tests::test_memory::test_store_should_add_an_element_to_the_memory 207590 --> 203090 | -2.17 %
evm::tests::test_memory::test_store_should_add_an_element_with_offset_to_the_memory 238080 --> 194990 | -18.10 %
evm::tests::test_memory::test_store_should_add_n_elements_to_the_memory 2263836 --> 2263826 | -0.00 %
****WORSENED****
evm::tests::test_memory::test_store_n_2_aligned_words 3018220 --> 3572750 18.37 %
Overall gas change: performance improvement, gas consumption-2.59 % As you can see changing the type of aligned store elements to |
(rebased on main) |
@enitrat can you retry measuring gas usage? I tried using |
@lambda-0x As long as you have a github token set in the dotenv file it should work locally |
seems to look good now |
(didn't expect 42% improvement in few tests) |
yeah, pow can get ridiculously expensive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Pull Request type
Please check the type of change your PR introduces:
What is the current behavior?
Resolves: #185
What is the new behavior?
Does this introduce a breaking change?