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

calculate operation cost only once #570

Closed
ayrat555 opened this issue Nov 5, 2018 · 0 comments · Fixed by #572
Closed

calculate operation cost only once #570

ayrat555 opened this issue Nov 5, 2018 · 0 comments · Fixed by #572
Assignees

Comments

@ayrat555
Copy link
Member

ayrat555 commented Nov 5, 2018

Currently, we're calculating operation cost two twice, the first time in Functions.not_enough_gas?, the second time when subtracting the cost in machine state.

The cost operation in top 20 most used operation in EVM

'Elixir.EVM.Gas':cost_with_status/2                                                     442309     0.34    131917  [      0.30]
'Elixir.EVM.Gas':operation_cost/4                                                       442309     0.38    145659  [      0.33]
'Elixir.EVM.Gas':memory_cost/3                                                          442309     0.42    161097  [      0.36]
'Elixir.Decimal':div_calc/5                                                             923353     0.54    210818  [      0.23]
'Elixir.Access':get/3                                                                   909342     0.60    230840  [      0.25]
'Elixir.EVM.Operation':metadata/1                                                      1769202     0.79    303990  [      0.17]
'Elixir.EVM.MachineCode':current_operation/2                                           1105747     0.80    309092  [      0.28]
'Elixir.EVM.Operation':inputs/2                                                        1105764     0.87    335668  [      0.30]
'Elixir.EVM.Stack':pop_n/2                                                             3119325     1.94    750072  [      0.24]
'Elixir.Macro':do_camelize/1                                                           3004991     2.06    797937  [      0.27]
'Elixir.EVM.MachineCode':do_valid_jump_destinations/2                                 16059398     4.67   1809400  [      0.11]
binary:at/2                                                                           17381808     4.96   1921120  [      0.11]
'Elixir.EVM.Operation':encode/1                                                       16280544     8.73   3380107  [      0.21]
'Elixir.EVM.Operation':decode/1                                                       16059398     8.98   3475724  [      0.22]
'Elixir.EVM.Operation':push_length/1                                                  16059398     9.16   3548780  [      0.22]
'Elixir.EVM.Operation':next_instr_pos/2                                               16059398     9.34   3616411  [      0.23]
'Elixir.Map':get/2                                                                    34351430     9.36   3625938  [      0.11]
'Elixir.EVM.Operation':get_operation_at/2                                             17386308    10.07   3899674  [      0.22]
'Elixir.Map':get/3                                                                    34351541    11.84   4585781  [      0.13]

related to #557

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 a pull request may close this issue.

1 participant