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

Benchmark modexp precompiled contract in different clients #185

Closed
pirapira opened this issue Jun 17, 2017 · 24 comments
Closed

Benchmark modexp precompiled contract in different clients #185

pirapira opened this issue Jun 17, 2017 · 24 comments

Comments

@pirapira
Copy link
Member

pirapira commented Jun 17, 2017

There is an opinion that the gas cost formula of modexp precompiled contract can be improved. To find out the reasonal gas cost formula we need to benchmark modexp contract of different clients up to blockgaslimit.

@timxor
Copy link

timxor commented Jun 17, 2017

@pirapira i can take that, looks fun. will work on it tonight

@pirapira
Copy link
Member Author

Great. You can choose

  • to prepare and run a BlockchainTest on each client

or

or

@timxor
Copy link

timxor commented Jun 18, 2017

@pirapira what option do you think would be better? Go it solo or join forces....maybe solo because then it goes horizontal not vertical :)

@pirapira
Copy link
Member Author

That's what I thought. The second option will be the quickest.

@timxor
Copy link

timxor commented Jun 18, 2017

agreed. on it.

@pirapira pirapira changed the title Benchmark modexp precompiled contract in different client Benchmark modexp precompiled contract in different clients Jun 19, 2017
@holiman
Copy link
Contributor

holiman commented Jun 19, 2017

I have a geth-benchmark implementation for modexp at https://github.com/holiman/go-ethereum/tree/benchmark_metro , the only thing I'm missing now are some proper values to use in testing. And I guess the other clients ought to use the same. Have either of you located any good inputs? I've found a few from the EIP examples, but I don't think they're very representative.

@timxor
Copy link

timxor commented Jun 19, 2017

This is awesome thanks for sharing, can we make a generator for testing all ranges or what do you think the best way to test it? Are there already tests in the test repo that we can use? @holiman

@holiman
Copy link
Contributor

holiman commented Jun 22, 2017

I've added some inputs to my branch the other day

@holiman
Copy link
Contributor

holiman commented Jun 22, 2017

@gumb0
Copy link
Member

gumb0 commented Jun 30, 2017

@tcsiwula Hi, is there any update from you on this?

@timxor
Copy link

timxor commented Jul 5, 2017

Hey @gumb0, I should have the parity one done by friday this week. I was interviewing for jobs the last two weeks. Is the c++ client still in active development? cc: @pirapira

@pirapira
Copy link
Member Author

pirapira commented Jul 6, 2017

@tcsiwula I sent you an email.

@winsvega
Copy link
Collaborator

to test benchmark we have to run a scenario with calling a function/opcode on different range of input parameters and eventually build up a graph "exec time / input parameters value"
I think making a static contract in state test is not a best option for determining the reasonable gas cost formula

@timxor
Copy link

timxor commented Aug 11, 2017

Hello everyone, here is an update from me. Let me know where I should focus my attention/efforts next. =)

My most recent (August 9th) parity benchmark results for {bn_128_add, bn_128_mul, ...}.

Here are the steps to recreate and run it locally on your computer (linux/ubuntu).

cc: @pirapira @holiman @arkpar @Souptacular

@pirapira
Copy link
Member Author

pirapira commented Aug 11, 2017

On my machine, I get 6 times different numbers for ecadd from
go-ethereum

BenchmarkPrecompiledBn256Add/chfast1-Gas=0-4                       20000             90297 ns/op

and Parity

test bn_128_add          ... bench:      14,527 ns/iter (+/- 413)

(will edit with links to steps)

@pirapira
Copy link
Member Author

The original purpose of this issue has been accomplished, as modexp gas formula has been determined.

Since we are here, maybe we can open issues for remaining problems and paste links here.

@timxor
Copy link

timxor commented Aug 13, 2017

@pirapira wonderful, yeah that sounds good to me. What other precompile benchmarks would be useful to have that would give us a complete and accurate picture?

@pirapira
Copy link
Member Author

@tcsiwula since ecadd and ecmul are supposed to be of constant gas costs, it would be great if we can come up with some numbers already.

@gcolvin
Copy link

gcolvin commented Aug 17, 2017

@tcsiwula just pointed me at this issue. I've been working with @s-matthew-english on improving the test suite at https://github.com/ethereum/cpp-ethereum/tree/develop/test/unittests/performance so that more opcodes and precompiles and more clients can be easily added to the suite. The more the merrier. The advantage of this suite is that it will work with any client with a command-line program that can interpret EVM binaries.

@winsvega
Copy link
Collaborator

@pirapira status?

@pirapira
Copy link
Member Author

No idea.

@winsvega
Copy link
Collaborator

I thought we came to the final gas price for this contract. @holiman

@holiman
Copy link
Contributor

holiman commented Sep 18, 2017

Yes, for all precompiles. I think we can close this ticket.. (?)

@pirapira
Copy link
Member Author

OK.

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

No branches or pull requests

6 participants