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

Compress contract specs with gzip and store in contractspecv0gzip #1178

Closed
wants to merge 1 commit into from

Conversation

leighmcculloch
Copy link
Member

@leighmcculloch leighmcculloch commented Dec 1, 2023

What

Compress contract specs with gzip and store in contractspecv0gzip.

Why

This is an experiment to see if compressing contracts specs would sufficiently address concerns of contract spec size. I used gzip out of convenience. Xz/lmza would be better, but I had problems building the libs for it which is a good signal it'd be too hard to adopt everywhere contract specs need decoding.

The results were underwhelming.

Most of the test vector contracts size in this repo reduced by tiny amounts, less than 40 bytes.

The token contract interface size was over 5000 bytes to start. Gzipping reduced it into the 3000s. However, when I removed the doc comments from the contract spec, the 5000+ byte spec was reduced to 1004 bytes, and then when I gzipped that it was reduced to only 963, a 41 byte saving without doc comments.

This is pretty good signal that doc comments are a large cost and simply not using them is a massive saving. And also that gzipping isn't a win without doc comments.

I'm not convinced compression is worth adding, but interested in hearing peoples thoughts.

Close #415

@leighmcculloch
Copy link
Member Author

Closing because the experiment is done and I won't pursue merging this, at least not without exploring alternatives. Thoughts and feedback still welcome though.

@leighmcculloch
Copy link
Member Author

cc @willemneal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Contract Spec: Experiment with compressed or optimized form of XDR
1 participant