Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Contracts::put_code benchmarks #4222

Closed
wants to merge 5 commits into from
Closed

Conversation

expenses
Copy link
Contributor

#3885 and #3819 note that put_code can take too long on large wasm files, and cause block production to fail. This PR adds benchmarks for this using compiled ink examples.

@expenses
Copy link
Contributor Author

Here's the resulting time for erc20 by the way:

wasms/erc20.wasm        time:   [6.4462 ms 6.5215 ms 6.5997 ms]
                        thrpt:  [7.6973 MiB/s 7.7897 MiB/s 7.8806 MiB/s]

This seems pretty fast, so maybe the problems only occur under certain conditions?

@expenses
Copy link
Contributor Author

@Stefie maybe you could run these benchmarks on your machine?

@gui1117
Copy link
Contributor

gui1117 commented Nov 27, 2019

this does benchmark put_code in native. I don't remember precisely but thoughts wasm was used always for block production. maybe in wasm the put_code performance are very different 🤔 ?

@expenses
Copy link
Contributor Author

Oh, good point! What would be the best way to benchmark in wasm then?

@gui1117
Copy link
Contributor

gui1117 commented Nov 27, 2019

Oh, good point! What would be the best way to benchmark in wasm then?

I don't know @pepyakin ?

@bkchr
Copy link
Member

bkchr commented Nov 27, 2019

@expenses you can setup a wasm blob like this one: https://github.com/paritytech/substrate/tree/master/primitives/runtime-interface/test-wasm

Expose a function benchmark_put_code or whatever. This function internally calls 1000x put_code. And you call this function from your benchmark. See here for on how to call it.

@Stefie
Copy link
Contributor

Stefie commented Nov 28, 2019

@Stefie maybe you could run these benchmarks on your machine?

Sorry, I was out of office yesterday. If you tell me how, I'm happy to do that! I never ran any benchmarking tests for Substrate.

The times I mentioned in #3885 were with the latest Docker image from https://hub.docker.com/r/parity/substrate/tags , btw

@expenses
Copy link
Contributor Author

@bkchr is this even possible, given that GenesisConfigs and TestExternalities only works under std?

@gavofyork gavofyork added the A0-please_review Pull request needs code review. label Nov 28, 2019
@bkchr
Copy link
Member

bkchr commented Nov 30, 2019

@expenses please look at the linked code, you create the storage etc from std and just call into wasm to execute the benchmark method.

@expenses
Copy link
Contributor Author

expenses commented Dec 4, 2019

Closing due to solutions having arised.

@expenses expenses closed this Dec 4, 2019
@bkchr bkchr deleted the ashley-put-code-benchmarks branch December 4, 2019 18:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants