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

Optimize get property for most primitive types #974

Merged
merged 14 commits into from
Oct 21, 2021

Conversation

Robbepop
Copy link
Collaborator

@Robbepop Robbepop commented Oct 21, 2021

Implements #972.

The main trick in this PR is that we "trust" SEAL in that it delivers correct inputs to ink! result buffers for functions like seal_caller.
Before this PR we additionally "checked" the given values by decoding them. Now we simply take their bit patterns directly.

This has turned many of the property functions into infallible functions.

Benchmarks

  • ERC-1155: 49.3 kB -> 49.1 kB
  • Trait-ERC-20: 29.3kB -> 29.1kB

Savings are not huge but go into the right direction.

@codecov-commenter
Copy link

codecov-commenter commented Oct 21, 2021

Codecov Report

Merging #974 (06d333e) into master (ee9015d) will decrease coverage by 15.15%.
The diff coverage is 5.88%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master     #974       +/-   ##
===========================================
- Coverage   78.97%   63.81%   -15.16%     
===========================================
  Files         244      244               
  Lines        9122     9148       +26     
===========================================
- Hits         7204     5838     -1366     
- Misses       1918     3310     +1392     
Impacted Files Coverage Δ
crates/env/src/backend.rs 0.00% <ø> (ø)
...tes/env/src/engine/experimental_off_chain/impls.rs 55.23% <0.00%> (-1.08%) ⬇️
crates/env/src/engine/off_chain/tests.rs 100.00% <ø> (ø)
crates/env/src/types.rs 22.22% <0.00%> (-22.23%) ⬇️
crates/lang/macro/src/lib.rs 100.00% <ø> (ø)
crates/lang/src/codegen/dispatch/execution.rs 0.00% <0.00%> (ø)
crates/lang/src/env_access.rs 12.00% <0.00%> (ø)
crates/env/src/api.rs 36.36% <11.11%> (ø)
crates/env/src/engine/off_chain/impls.rs 42.98% <11.11%> (-4.24%) ⬇️
crates/lang/codegen/src/traits.rs 0.00% <0.00%> (-100.00%) ⬇️
... and 45 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 ee9015d...06d333e. Read the comment docs.

Copy link
Contributor

@athei athei left a comment

Choose a reason for hiding this comment

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

Makes total sense to me. No need to bubble this up to the poor user. Those should be infallible.

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.

3 participants