cli, completion: compress some const
strings
#652
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This uses
supersnappy
, which is a zero-dependency pure-Nimimplementation of Google's Snappy.
With it, it is straightforward to compress our larger
const
stringsat compile time and uncompress them at run time. For now, this commit
compresses:
configlet --help
messagesupersnappy
is less than 500 lines of code, which is why compressingthese strings (which aren't so large) produces a slightly smaller
configlet binary, despite the added dependency.
We may end up adding
zippy
as a dependency if configlet learnsto make network requests (e.g. for the online
configlet lint
checks)so that we can use gzip. But we can't use
zippy
at compile time, so itisn't useful for this commit, even though the compression is better.
zippy
is also a bigger dependency (about 40 KiB), so it wouldn'tproduce a net saving for this commit anyway.
nim-snappy
is an alternative Snappy implementation, but it wouldadd dependencies on
faststreams
,unittest2
, andstew
.Closes: #651