Skip to content

Instantly share code, notes, and snippets.

@holiman
Created June 30, 2017 13:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save holiman/7b157e4074707f6ba3196d46ad3745af to your computer and use it in GitHub Desktop.

From the new Metro-pr at ethereum/go-ethereum#14726

#go test . -run - -bench Benchmark -benchtime 5s
BenchmarkPrecompiledEcdsa/-Gas=3000-8  	   50000	    174450 ns/op
BenchmarkPrecompiledSha256/128-Gas=108-8         	10000000	       690 ns/op
BenchmarkPrecompiledRipeMD/128-Gas=1080-8        	 3000000	      2356 ns/op
BenchmarkPrecompiledIdentity/128-Gas=27-8        	500000000	        18.7 ns/op
BenchmarkPrecompiledModexp/eip_example1-Gas=4197376-8         	   50000	    139575 ns/op
BenchmarkPrecompiledModexp/eip_example2-Gas=4459488-8         	 1000000	      7918 ns/op
BenchmarkPrecompiledBn256Add/chfast1-Gas=0-8                  	  100000	     72309 ns/op
BenchmarkPrecompiledBn256Add/chfast2-Gas=0-8                  	  100000	     77082 ns/op
BenchmarkPrecompiledBn256ScalarMul/chfast1-Gas=0-8            	   10000	    707198 ns/op
BenchmarkPrecompiledBn256ScalarMul/chfast2-Gas=0-8            	    3000	   2748802 ns/op
BenchmarkPrecompiledBn256ScalarMul/chfast3-Gas=0-8            	    3000	   2722783 ns/op
BenchmarkPrecompiledPairing/jeff1-Gas=160000-8                	     300	  26254395 ns/op
BenchmarkPrecompiledPairing/jeff2-Gas=160000-8                	     300	  26270137 ns/op
BenchmarkPrecompiledPairing/jeff3-Gas=160000-8                	     300	  26865023 ns/op
BenchmarkPrecompiledPairing/jeff4-Gas=220000-8                	     200	  33845527 ns/op
BenchmarkPrecompiledPairing/jeff5-Gas=220000-8                	     200	  33726438 ns/op
BenchmarkPrecompiledPairing/jeff6-Gas=160000-8                	     300	  26327948 ns/op
BenchmarkPrecompiledPairing/empty_data-Gas=40000-8            	500000000	        15.6 ns/op
BenchmarkPrecompiledPairing/one_point-Gas=100000-8            	     500	  18404827 ns/op
BenchmarkPrecompiledPairing/two_point_match_2-Gas=160000-8    	     500	  16035837 ns/op
BenchmarkPrecompiledPairing/two_point_match_3-Gas=160000-8    	     300	  26066772 ns/op
BenchmarkPrecompiledPairing/two_point_match_4-Gas=160000-8    	     300	  25983786 ns/op
BenchmarkPrecompiledPairing/ten_point_match_1-Gas=640000-8    	     100	  70304992 ns/op
BenchmarkPrecompiledPairing/ten_point_match_2-Gas=640000-8    	     100	  82823341 ns/op
BenchmarkPrecompiledPairing/ten_point_match_3-Gas=160000-8    	     300	  25751592 ns/op
BenchmarkOpAdd64-8                                            	30000000	       240 ns/op
BenchmarkOpAdd128-8                                           	30000000	       248 ns/op
BenchmarkOpAdd256-8                                           	30000000	       262 ns/op
BenchmarkOpSub64-8                                            	30000000	       261 ns/op
BenchmarkOpSub128-8                                           	20000000	       305 ns/op
BenchmarkOpSub256-8                                           	20000000	       387 ns/op
BenchmarkOpMul-8                                              	20000000	       478 ns/op
BenchmarkOpDiv256-8                                           	10000000	       716 ns/op
BenchmarkOpDiv128-8                                           	20000000	       332 ns/op
BenchmarkOpDiv64-8                                            	30000000	       275 ns/op
BenchmarkOpSdiv-8                                             	10000000	      1056 ns/op
BenchmarkOpMod-8                                              	10000000	       688 ns/op
BenchmarkOpSmod-8                                             	10000000	      1138 ns/op
BenchmarkOpExp-8                                              	  200000	     33435 ns/op
BenchmarkOpSignExtend-8                                       	20000000	       428 ns/op
BenchmarkOpLt-8                                               	20000000	       396 ns/op
BenchmarkOpGt-8                                               	20000000	       392 ns/op
BenchmarkOpSlt-8                                              	10000000	       650 ns/op
BenchmarkOpSgt-8                                              	10000000	       644 ns/op
BenchmarkOpEq-8                                               	20000000	       376 ns/op
BenchmarkOpAnd-8                                              	20000000	       355 ns/op
BenchmarkOpOr-8                                               	20000000	       359 ns/op
BenchmarkOpXor-8                                              	20000000	       368 ns/op
BenchmarkOpByte-8                                             	20000000	       354 ns/op
BenchmarkOpAddmod-8                                           	10000000	       919 ns/op
BenchmarkOpMulmod-8                                           	10000000	      1186 ns/op
PASS
ok  	github.com/ethereum/go-ethereum/core/vm	454.802s

Translates into

PrecompiledEcdsa/                             0.0172 gas/ns
PrecompiledSha256/128                         0.1565 gas/ns
PrecompiledRipeMD/128                         0.4584 gas/ns
PrecompiledIdentity/128                       1.4439 gas/ns
PrecompiledModexp/eip_example1               30.0725 gas/ns
PrecompiledModexp/eip_example2              563.2089 gas/ns
PrecompiledBn256Add/chfast1                   0.0000 gas/ns
PrecompiledBn256Add/chfast2                   0.0000 gas/ns
PrecompiledBn256ScalarMul/chfast1             0.0000 gas/ns
PrecompiledBn256ScalarMul/chfast2             0.0000 gas/ns
PrecompiledBn256ScalarMul/chfast3             0.0000 gas/ns
PrecompiledPairing/jeff1                      0.0061 gas/ns
PrecompiledPairing/jeff2                      0.0061 gas/ns
PrecompiledPairing/jeff3                      0.0060 gas/ns
PrecompiledPairing/jeff4                      0.0065 gas/ns
PrecompiledPairing/jeff5                      0.0065 gas/ns
PrecompiledPairing/jeff6                      0.0061 gas/ns
PrecompiledPairing/empty_data              2564.1026 gas/ns
PrecompiledPairing/one_point                  0.0054 gas/ns
PrecompiledPairing/two_point_match_2          0.0100 gas/ns
PrecompiledPairing/two_point_match_3          0.0061 gas/ns
PrecompiledPairing/two_point_match_4          0.0062 gas/ns
PrecompiledPairing/ten_point_match_1          0.0091 gas/ns
PrecompiledPairing/ten_point_match_2          0.0077 gas/ns
PrecompiledPairing/ten_point_match_3          0.0062 gas/ns
@smatthewenglish
Copy link

smatthewenglish commented Aug 10, 2017

which directory are you in when you run this command? when I tried to run it in /test I got this error:

enter image description here

@smatthewenglish
Copy link

ok so- now I realize what I was doing wring- maybe I'll just leave that artifact here though in case someone has the same troubles as I had.

What you need to do is- make sure that your in your gopath, what the hell is gopath you ask? look at this
and make sure your branch is up to date.

run the command from this directory:

/Users/s.matthew.english/go/src/github.com/ethereum/go-ethereum/core/vm

where your gopath is this:

echo $GOPATH
/Users/s.matthew.english/go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment