gballet / go-ethereum

Official Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
23 stars 13 forks source link

shower thought: remove right/left padding when it makes sense #461

Open gballet opened 4 months ago

gballet commented 4 months ago

When a value is 0, 32 bytes worth of 0s are stored. This is very wasteful and could be improved by adding a special encoding to strip them out if it's worth it.

It needs to be assessed at serialization time if using e.g. rlp or rle saves space by counting zeros while serializing the leaves, and then choosing the methods: if there are more zeros than leaves, it's worth using rle.