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

feat(wasm-builder): Set optimisation params #2973

Merged
merged 3 commits into from
Jul 22, 2023
Merged

Conversation

ukint-vs
Copy link
Member

@ukint-vs ukint-vs commented Jul 21, 2023

Resolves # .

These changes reduce the size of wasm artifacts and speed up programs.

stress_transfer benchmark (updated):

before: Gas burned for one transfer operation = 0.9770345439034853 * 10^9. Calculated as geometric mean from 100 transfer operations.
after:  Gas burned for one transfer operation = 0.9441607030742862 * 10^9. Calculated as geometric mean from 100 transfer operations.

Artifact size:

fungible-token upload fees

before:
4.254320105 unit
after:
3.609106373 unit
Before After program
54 Ki 46 Ki demo_async.opt.wasm
35 Ki 32 Ki demo_async_custom_entry.opt.wasm
53 Ki 44 Ki demo_async_init.opt.wasm
50 Ki 42 Ki demo_async_recursion.opt.wasm
51 Ki 42 Ki demo_async_signal_entry.opt.wasm
55 Ki 45 Ki demo_async_tester.opt.wasm
19 Ki 18 Ki demo_btree.opt.wasm
18 Ki 14 Ki demo_calc_hash_in_one_block.opt.wasm
37 Ki 21 Ki demo_calc_hash_over_blocks.opt.wasm
51 Ki 43 Ki demo_compose.opt.wasm
48 Ki 30 Ki demo_constructor.opt.wasm
56 Ki 48 Ki demo_distributor.opt.wasm
41 Ki 28 Ki demo_fungible_token.opt.wasm
58 Ki 48 Ki demo_futures_unordered.opt.wasm
51 Ki 42 Ki demo_incomplete_async_payloads.opt.wasm
50 Ki 40 Ki demo_init_fail_sender.opt.wasm
48 Ki 39 Ki demo_init_wait_reply_exit.opt.wasm
51 Ki 43 Ki demo_ncompose.opt.wasm
17 Ki 16 Ki demo_node.opt.wasm
5.9 Ki 6.7 Ki demo_piggy_bank.opt.wasm
5.9 Ki 5.9 Ki demo_ping.opt.wasm
71 Ki 62 Ki demo_rwlock.opt.wasm
13 Ki 14 Ki demo_send_from_reservation.opt.wasm
27 Ki 27 Ki demo_signal_entry.opt.wasm
27 Ki 13 Ki demo_stack_allocations.opt.wasm
50 Ki 41 Ki demo_sync_duplicate.opt.wasm
56 Ki 46 Ki demo_wait_timeout.opt.wasm
72 Ki 60 Ki demo_waiter.opt.wasm
49 Ki 40 Ki demo_waiting_proxy.opt.wasm
61 Ki 58 Ki test_syscalls.opt.wasm

@gear-tech/dev

@ukint-vs ukint-vs added A0-pleasereview PR is ready to be reviewed by the team D5-tooling Helper tools and utilities D7-performance Increase our node/runtime/programs execution work performance labels Jul 21, 2023
@ukint-vs ukint-vs self-assigned this Jul 21, 2023
Copy link
Member

@breathx breathx left a comment

Choose a reason for hiding this comment

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

👍🏻
It'd be good compare upload program cost for some of them

utils/wasm-builder/src/wasm_project.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@clearloop clearloop left a comment

Choose a reason for hiding this comment

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

what about going with O4 plus shrink-level-2?

for -Oz vs -O4, the difference is optimization level 2 ( + shrink-level-2) vs optimization level 4, see
https://docs.rs/wasm-opt/0.113.0/wasm_opt/struct.OptimizationOptions.html#method.new_optimize_for_size_aggressively for structured docs


btw, super curious why tests::locking_gas_for_waitlist works in this PR but failed in all of my PRs xd

@ukint-vs
Copy link
Member Author

what about going with O4 plus shrink-level-2?

for -Oz vs -O4, the difference is optimization level 2 ( + shrink-level-2) vs optimization level 4, see docs.rs/wasm-opt/0.113.0/wasm_opt/struct.OptimizationOptions.html#method.new_optimize_for_size_aggressively for structured docs

in some cases it is faster, but the size is similar

@ukint-vs
Copy link
Member Author

👍🏻 It'd be good compare upload program cost for some of them

Added to description

@ukint-vs ukint-vs merged commit e1059c0 into master Jul 22, 2023
10 checks passed
@ukint-vs ukint-vs deleted the vs/opt-wasm-builder branch July 22, 2023 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-pleasereview PR is ready to be reviewed by the team D5-tooling Helper tools and utilities D7-performance Increase our node/runtime/programs execution work performance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants