clones-with-immutable-args
clones-with-immutable-args copied to clipboard
Memory copy loop optimization
This loop could be replaced with CALLDATACOPY():
https://github.com/wighawag/clones-with-immutable-args/blob/5950723ffcfa047f13262e5dbd7218b54360c42e/src/ClonesWithImmutableArgs.sol#L126-L134
Alternatively, if one really wants to keep the data in memory, one can use the identity precompile to copy from memory to memory. It should be cheaper if that loop runs more than 2 times (please check).
Yep, I see method is internal and argument is not calldata, then really consider using “identity” precompile for copying
If that loop is replaced, copyPtr and dataPtr both need to be increased still, right?
And I think counter needs to be decreased, too. Otherwise mask will be wrong
this looks great. any thoughts on integrating @wighawag ?
Implemented this optimization using the identity precompile on this fork in case anyone's interested: https://github.com/RollaProject/clones-with-immutable-args/commit/3cef7aeca219cdfb3370c3e7a59f40c022fc89ae
@z0r0z @wighawag Please let me know if a PR with this change would be welcome :)
How much did deploy and call costs change with the identity precompile?
On May 23, 2022, at 4:16 AM, 0xca11.eth @.***> wrote:
Implemented this optimization using the identity precompile on this fork in case anyone's interested: @.***
@z0r0z @wighawag Please let me know if a PR with this change would be welcome :)
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.