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

gas of creationCodeFor #6

Open
thedavidmeister opened this issue Jun 25, 2022 · 0 comments
Open

gas of creationCodeFor #6

thedavidmeister opened this issue Jun 25, 2022 · 0 comments

Comments

@thedavidmeister
Copy link

thedavidmeister commented Jun 25, 2022

i noticed that the gas cost of creationCodeFor for ~1500 bytes is ~7.2k gas

i'm assuming this is due to the 2x abi.encodePacked calls that would be allocating and building new bytes in memory each time

i saw creationCodeFor above 90k gas for about 20kb of data

i was thinking that if SSTORE2 could setup a region in memory with all the creation code prefilled followed by X bytes, and return a pointer to the start of X bytes, then devs willing to use assembly could potentially efficiently populate the X bytes themselves (a gas cost they would have to pay either way) then ask SSTORE just to deploy the result without further processing

i'll attempt to do this myself locally and report back on whether the approach helps

FYI the deploy cost of the same 1500 bytes was ~327k gas, so the overhead is ~2%

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

No branches or pull requests

1 participant