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

cli, completion: compress some const strings #652

Merged
merged 1 commit into from
Aug 9, 2022

Conversation

ee7
Copy link
Member

@ee7 ee7 commented Aug 6, 2022

This uses supersnappy, which is a zero-dependency pure-Nim
implementation of Google's Snappy.

With it, it is straightforward to compress our larger const strings
at compile time and uncompress them at run time. For now, this commit
compresses:

  • The configlet --help message
  • The completion scripts

supersnappy is less than 500 lines of code, which is why compressing
these 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 learns
to 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 it
isn't useful for this commit, even though the compression is better.
zippy is also a bigger dependency (about 40 KiB), so it wouldn't
produce a net saving for this commit anyway.

nim-snappy is an alternative Snappy implementation, but it would
add dependencies on faststreams, unittest2, and stew.

Closes: #651

Copy link
Member

@ErikSchierboom ErikSchierboom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ee7 ee7 merged commit 1d689ed into exercism:main Aug 9, 2022
@ee7 ee7 deleted the cli-completion-compress-large-strings branch August 9, 2022 11:06
@ee7 ee7 changed the title cli, completion: compress large strings cli, completion: compress some const strings Aug 9, 2022
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.

consider compressing large strings
2 participants