feat: Re-optimize alphabet for Brotli (only chars unused by gzip backrefs) #310
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.
A follow-up for #309: Although the Brotli size is currently not counted, probably this would be nice to have.
The "brotlied" built
non-secure nanoid
size goes down from 146 bytes to 129.The gzip sizes are unchanged for all entries.
How does it work
Currently only
'use
,andom
andrict'
are used to utilize the gzip backrefs. Other chars are just sorted alphabetically (they cannot form a gzip backref so their order is not significant for gzip).But we also have brotli! And brotli has a built-in the default dictionary. All we need is to rerrange those "other chars" to form some substrings from the dictionary.
After a day running an ad-hoc script gave the answer for the Ultimate Question of
Life, the Universe, and Everythingthis bizarre Scrabble game:-26T
1983
40px
(uppercased)75px
bush
(uppercased)jack
(uppercased)mind
(uppercased)very
(uppercased)wolf
(uppercased)That forms a "phrase"
-26T198340PX75pxJACKVERYMINDBUSHWOLF
Equally good, also producing 129 bytes
Honorable mention (132 bytes)