AntelopeIO / eos-vm

Other
6 stars 10 forks source link

`eos_vm` 7% perf improvement by optimizing the expensive `get_imported_functions_size` function. #28

Closed greg7mdp closed 1 month ago

greg7mdp commented 1 month ago

This improves the performance of eos-vm by about 7% (reduces total time from 6.8% to 1.55%, however the time spent in execute is 75% of the total execution time for api_part2_tests).

Running the perf tool, I noticed that get_imported_functions_size was one of the top cpu users. Most of the time is spent calling size() and doing an unnecessary check (that _index, the i in the loop, is less than size()).

This streamlines the code.

pre optimization:

pre_optim

post optimization:

post_optim

Also fixes an incorrect std::forward use, of no consequense since the forwarded data has no pointers and is moved anyways.