Skip to content
This repository has been archived by the owner on Jan 24, 2022. It is now read-only.

Reduce asm in Proxy.sol #1487

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Reduce asm in Proxy.sol #1487

wants to merge 2 commits into from

Conversation

k06a
Copy link
Contributor

@k06a k06a commented Feb 29, 2020

No description provided.

Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

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

This is a great suggestion, thank you @k06a! Sorry for taking a while to review.

packages/lib/contracts/upgradeability/Proxy.sol Outdated Show resolved Hide resolved
@k06a
Copy link
Contributor Author

k06a commented Mar 9, 2020

What about a new version? Or you think performance will be different and in this place it is more matter?

@frangio
Copy link
Contributor

frangio commented Mar 9, 2020

I'm not sure I understod the question. A new version of what? Do you mean upgrading to Solidity 0.6?

@k06a
Copy link
Contributor Author

k06a commented Mar 10, 2020

@frangio I mean I added new commit to handle this 😁

@frangio
Copy link
Contributor

frangio commented Mar 10, 2020

I really like this! I would like someone else to look at it because it's quite critical.

Comment on lines +35 to +36
case 0 { revert(add(data, 32), returndatasize) }
default { return(add(data, 32), returndatasize) }
Copy link
Contributor

Choose a reason for hiding this comment

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

A small optimization, although the compiler may catch this too.

Suggested change
case 0 { revert(add(data, 32), returndatasize) }
default { return(add(data, 32), returndatasize) }
let data_start := add(data, 32)
case 0 { revert(data_start, returndatasize) }
default { return(data_start, returndatasize) }

I also considered using mload(data) instead of returndatasize but it seems to be more expensive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried mload(data), but tests failed

Copy link
Contributor

Choose a reason for hiding this comment

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

That's interesting. Did you understand why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@frangio not yet, will check

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants