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

Add run length encoding to contract binary format for x86 #595

Closed
Earlz opened this issue Aug 21, 2018 · 1 comment
Closed

Add run length encoding to contract binary format for x86 #595

Earlz opened this issue Aug 21, 2018 · 1 comment
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

Comments

@Earlz
Copy link
Contributor

Earlz commented Aug 21, 2018

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.

@Earlz Earlz added 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 labels Aug 21, 2018
@Earlz
Copy link
Contributor Author

Earlz commented Feb 6, 2019

done

@Earlz Earlz closed this as completed Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant