-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add production profile to substrate-wasm-builder
#10747
Conversation
I'm looking forward to it 🤣 |
But how to you do it? Do you have a separate benchmarking machine that is not used by the bot? |
Exactly. Running all of them takes around 8 hrs, I will just start it now and have some preliminary results tomorrow. |
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
I rerun them two times on |
The contracts usually are only interested in the weight associated with the
A PR was merged in the meantime that fixed a bug which affected the weight there. So this is expected since this PR isn't up-to-date against the latest master. |
Okay good to know.
We are already working on better tooling 😆 |
Basically every wasm instruction for gas metering. Note that we only care about It is still suspicious that the overall weight changes so much. One could think this might be some linear regression fuckup where the weight merely shifted around. However, it is consistent with other wasmi benchmarks we have where |
Thanks! Somehow I did not see those. |
Rerun on the bm2 server. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
/benchmark runtime pallet pallet_contracts |
Benchmark Runtime Pallet for branch "at-runtime-profiles" with command cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic="*" --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs Toolchain: stable-x86_64-unknown-linux-gnu (default) Results
|
…--manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs
bot merge |
Bot will approve on the behalf of @bkchr, since they are a team lead, in an attempt to reach the minimum approval count |
I guess I can figure out what should we do to make sure we are taking the best practice on optimizing the releases but it will be helpful if we have some docs explaining the exact steps. Do we need to do anything at all other than bump the wasm builder version? |
Bump wasm builder and define a
Yes:
If you defined a |
* Add production profile to wasm builder * Fix profile detection * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Replace panic! by println! + exit * Default to `release` for wasm on debug builds * Replaced unwrap by expect * Update all weights Rerun on the bm2 server. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Parity Bot <admin@parity.io>
* Add production profile to wasm builder * Fix profile detection * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Replace panic! by println! + exit * Default to `release` for wasm on debug builds * Replaced unwrap by expect * Update all weights Rerun on the bm2 server. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Parity Bot <admin@parity.io>
* Add production profile to wasm builder * Fix profile detection * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Replace panic! by println! + exit * Default to `release` for wasm on debug builds * Replaced unwrap by expect * Update all weights Rerun on the bm2 server. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Parity Bot <admin@parity.io>
* Add production profile to wasm builder * Fix profile detection * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Replace panic! by println! + exit * Default to `release` for wasm on debug builds * Replaced unwrap by expect * Update all weights Rerun on the bm2 server. Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * cargo run --quiet --profile=production --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_contracts --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/contracts/src/weights.rs --template=./.maintain/frame-weight-template.hbs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Parity Bot <admin@parity.io>
After we now established that compiling the client with
lto
andcodegen-units=1
yields substantial performance improvements we should now do the same for the runtime. We already noticed that we need those optimizations for wasmi to perform well [1].This PR does the following
production
profile to the generated wasm project by the wasm builder with the same values as for the client.release
fordebug
main builds to be consistent with existing behaviour).lto=thin
to speed up development (was using fat before).Note that we need to regenerate all weights here before we can merge. Not sure what would be the best way to do that. @ggwpez what do you think?
This reduces the outputted wasm binary size:
before
after