Skip to content

Streamlined ABI encoder logic for returning tuple types#2302

Merged
fubuloubu merged 2 commits into
vyperlang:masterfrom
iamdefinitelyahuman:optimize-tuple-return
Feb 16, 2021
Merged

Streamlined ABI encoder logic for returning tuple types#2302
fubuloubu merged 2 commits into
vyperlang:masterfrom
iamdefinitelyahuman:optimize-tuple-return

Conversation

@iamdefinitelyahuman

Copy link
Copy Markdown
Contributor

What I did

Simplify the logic around returning tuples, when each member of the tuple is of the same type.

How I did it

Add a special if branch that replicates the logic for returning an array type. This branch is only reached if every member of the tuple has the same type, and that type is a base type (or array of the base type).

This has a not-insignificant effect on the bytecode size.

How to verify it

Run tests (TODO)

Cute Animal Picture

Cute aminals are for closers.

@codecov-io

codecov-io commented Feb 15, 2021

Copy link
Copy Markdown

Codecov Report

Merging #2302 (0605abb) into master (27e8e66) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2302      +/-   ##
==========================================
- Coverage   85.84%   85.81%   -0.04%     
==========================================
  Files          85       85              
  Lines        8539     8556      +17     
  Branches     2034     2040       +6     
==========================================
+ Hits         7330     7342      +12     
- Misses        727      730       +3     
- Partials      482      484       +2     
Impacted Files Coverage Δ
vyper/codegen/return_.py 100.00% <100.00%> (ø)
vyper/functions/functions.py 89.25% <0.00%> (-0.57%) ⬇️

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 27e8e66...0605abb. Read the comment docs.

@fubuloubu fubuloubu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add a few tests

@iamdefinitelyahuman iamdefinitelyahuman marked this pull request as ready for review February 15, 2021 23:58
@fubuloubu fubuloubu merged commit b378bfd into vyperlang:master Feb 16, 2021
@iamdefinitelyahuman iamdefinitelyahuman deleted the optimize-tuple-return branch February 16, 2021 10:28
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