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

core/vm: use pointers to operations vs. copy by value #21336

Merged
merged 1 commit into from
Jul 21, 2020

Conversation

karalabe
Copy link
Member

@karalabe karalabe commented Jul 16, 2020

This is a funky heuristic optimization based on the ideas from #21180. I'm not entirely sure why this makes our tight loop faster, but the snail tracer has a 5% speed gain vs master.

I was benchmarking via

$ evm --statdump --codefile snailtracer.hex run  1>/dev/null

Where the snail tracer is https://gist.github.com/karalabe/dc2fd6add66341c60e7cc96b91ba0f76

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@karalabe karalabe added this to the 1.9.17 milestone Jul 16, 2020
@holiman
Copy link
Contributor

holiman commented Jul 20, 2020

I did a little experiment. master versus this pr, versus #21193

[user@work go-ethereum]$ for i in {1..5}; do build/bin/evm-master --statdump --codefile snailtracer.hex run  2>&1 1>/dev/null  | grep time ; done
execution time:  392.978976ms
execution time:  388.336157ms
execution time:  386.650593ms
execution time:  582.198802ms
execution time:  436.742533ms
[user@work go-ethereum]$ for i in {1..5}; do build/bin/evm-karalabe --statdump --codefile snailtracer.hex run  2>&1 1>/dev/null  | grep time ; done
execution time:  336.529811ms
execution time:  442.506244ms
execution time:  406.039679ms
execution time:  358.390552ms
execution time:  493.00324ms
[user@work go-ethereum]$ for i in {1..5}; do build/bin/evm-holiman --statdump --codefile snailtracer.hex run  2>&1 1>/dev/null  | grep time ; done
execution time:  345.169556ms
execution time:  333.998188ms
execution time:  433.470609ms
execution time:  439.249263ms
execution time:  340.805428ms

@holiman
Copy link
Contributor

holiman commented Jul 20, 2020

So the stats are :

  • master: 437.4ms
  • this PR: 407.3ms
  • other PR: 378.5ms

@holiman
Copy link
Contributor

holiman commented Jul 20, 2020

With both PRs, I get this:

[user@work go-ethereum]$ for i in {1..5}; do build/bin/evm-both --statdump --codefile snailtracer.hex run  2>&1 1>/dev/null  | grep time ; done
execution time:  331.148506ms
execution time:  422.554855ms
execution time:  333.043146ms
execution time:  386.965078ms
execution time:  364.806642ms

average 367ms

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.

2 participants