More thoughts on 0 bytes
Opened this issue ยท 10 comments
So it looks like having 5 leading zero bytes is helpful in reducing deployment costs.
Would it be possible to have a pattern that requires the first 5 bytes to be zero and then adds extra score for more zero bytes anywhere else in the address?
Actually, nevermind. Deployment cost ended up being the same.
Sorry. Still thinking this through. This might be true.
I'm ready to add functionality, just generalize the required pattern over the hash as much as possible and I'll add it. I.e, is 2 leading zero bytes + 4 additional random zero bytes better than 4 leading zero bytes and 0 additional random zero bytes?
I think leading zero bytes are always worth a lot more than random zero bytes. But among the addresses found with n leading zero bytes, it should prefer ones where more mixed in zero bytes are found.
Leading Zero Bytes: Weight 20
Random Zero Byte: Weight 1
Reasoning:
- Leading zero bytes will reduce bytecode that involves the address, making deployments cheaper.
- Mixed in zero bytes will make calls cheaper when the address is used in the calldata.
Wonderful, I'll implement this tomorrow and upload a new release.
Thanks, I will definitely be using this once it is available :)
Yeah, sorry for the long delay. Been prioritizing day work, will try to get this done during the week.
Will you have any time to work on this soon? If not, could you give some guidance. I'm about ready to deploy some contracts and would like to have lots of leading and mixed 0s
I think my comment goes along the lines with this request - I would like to score for zero-bytes. This is important for gas-optimization purposes (each non-zero byte in calldata
in 18 gas while zero bytes are only 4, please don't ask why does this matter ๐ )
Currently, it seems --zeros
option scores for individual zero characters. However, from gas-optimization standpoint, byte alignment is crucial - eg. 2005
is same as 2525
(2 non-zero bytes), but 0025
is much better (1 zero byte, 1 non-zero byte). Thus, it would be great to optimize for zero-bytes @johguse please. Thanks!