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

Extract non-generic part of push_topic to reduce code size #1026

Merged
merged 2 commits into from
Nov 19, 2021

Conversation

ascjones
Copy link
Collaborator

Marginal total of 0.3KB (10.3 down from 10.6) on ERC20.

However it appears to reduce the amount of increase of each additional type of topic (see example below), since the extracted non generic part will not be duplicated each time. e.g. commenting out the Option<AccountId> topics

image

master 10.2 -> 10.6 = +0.4
this PR 10.1 -> 10.3 = +0.2

Rel #990

@codecov-commenter
Copy link

codecov-commenter commented Nov 19, 2021

Codecov Report

Merging #1026 (9839168) into master (83448d4) will decrease coverage by 16.30%.
The diff coverage is n/a.

❗ Current head 9839168 differs from pull request most recent head f73d8c8. Consider uploading reports for the commit f73d8c8 to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##           master    #1026       +/-   ##
===========================================
- Coverage   78.87%   62.57%   -16.31%     
===========================================
  Files         246      246               
  Lines        9260     9258        -2     
===========================================
- Hits         7304     5793     -1511     
- Misses       1956     3465     +1509     
Impacted Files Coverage Δ
crates/lang/codegen/src/traits.rs 0.00% <0.00%> (-100.00%) ⬇️
crates/lang/ir/src/ir/contract.rs 0.00% <0.00%> (-100.00%) ⬇️
crates/lang/codegen/src/generator/env.rs 0.00% <0.00%> (-100.00%) ⬇️
crates/lang/codegen/src/generator/mod.rs 0.00% <0.00%> (-100.00%) ⬇️
crates/lang/codegen/src/enforced_error.rs 0.00% <0.00%> (-100.00%) ⬇️
crates/lang/codegen/src/generator/blake2b.rs 0.00% <0.00%> (-100.00%) ⬇️
crates/lang/codegen/src/generator/storage.rs 0.00% <0.00%> (-100.00%) ⬇️
crates/lang/codegen/src/generator/arg_list.rs 0.00% <0.00%> (-100.00%) ⬇️
crates/lang/codegen/src/generator/contract.rs 0.00% <0.00%> (-100.00%) ⬇️
crates/lang/codegen/src/generator/dispatch.rs 0.00% <0.00%> (-100.00%) ⬇️
... and 56 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83448d4...f73d8c8. Read the comment docs.

@paritytech-ci
Copy link

paritytech-ci commented Nov 19, 2021

🦑 📈 ink! Example Contracts ‒ Size Change Report 📉 🦑

These are the results of building the examples/* contracts from this branch with cargo-contract 0.15.0:

Δ Original Size Δ Optimized Size Total Optimized Size
accumulator 6.20 K
adder 7.43 K
contract-terminate 1.50 K
contract-transfer 7.97 K
delegator 10.04 K
dns -0.54 K -0.64 K 21.72 K
erc1155 -0.57 K -0.66 K 47.60 K
erc20 -0.17 K -0.30 K 10.33 K
erc721 -0.59 K -0.69 K 36.29 K
flipper 2.02 K
incrementer 1.94 K
multisig -1.44 K -1.43 K 46.17 K
rand-extension -0.04 K -0.16 K 4.73 K
subber 7.44 K
trait-erc20 -0.34 K -0.47 K 27.50 K
trait-flipper 1.83 K
trait-incrementer 1.99 K

Link to the run | Last update: Fri Nov 19 14:32:57 CET 2021

@Robbepop
Copy link
Collaborator

Does this still result in the same gains after moving to the inner function approach?

@ascjones
Copy link
Collaborator Author

Does this still result in the same gains after moving to the inner function approach?

It did for erc20, yes. I've just triggered the CI job again so let's see.

@ascjones
Copy link
Collaborator Author

Not sure how to get the bot to repost the example contract sizes, this might be the run: https://gitlab.parity.io/parity/ink-waterfall/-/jobs/1232706.

Anyway testing locally revealed the same improvement.

Copy link
Collaborator

@Robbepop Robbepop left a comment

Choose a reason for hiding this comment

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

LGTM

@ascjones ascjones merged commit d76b2f1 into master Nov 19, 2021
@ascjones ascjones deleted the aj-push-topic-inner branch November 19, 2021 15:11
xgreenx pushed a commit to Supercolony-net/ink that referenced this pull request Feb 8, 2022
…#1026)

* Extract non-generic part of `push_topic`

* Move to inner fn
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

Successfully merging this pull request may close these issues.

4 participants