Add run length encoding to contract binary format for x86 #595
Labels
P2-NiceToHave
Not anything absolutely needed, but is a good task that'd be nice to complete
x86
Tasks related to Qtum's x86 VM
With x86 programs, there is especially a lot of runs of 0. We should optimize the format used on the blockchain by using a very simple run length encoding system. With this, only the byte 0 would be affected by this, as other values are too random to benefit.
Basic psuedo code:
Loop through bytedata
if data is 0 and the next data is also 0, then error.
If data is 0, then write 0 next data times, and then advance data to next value.
Otherwise, write data.
Advance data to next value
end loop
Because there is already size fields in the binary stream, no dynamic allocations are needed and this should require only one cheap scan through the data.
The text was updated successfully, but these errors were encountered: