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

Make the base 83 encoding optional. #93

Open
ioistired opened this issue Nov 2, 2020 · 1 comment
Open

Make the base 83 encoding optional. #93

ioistired opened this issue Nov 2, 2020 · 1 comment
Labels
algorithm Relates to the BlurHash algorithm enhancement New feature or request

Comments

@ioistired
Copy link

Suppose I want to store 80,000 pre-blurred images in my database. LjIY5?00?bIUofWBWBM{WBofWBj[ is a sample 4×3 blurHash, and is 28 bytes (224 bits) long. Suppose I use a fixed-width data type in my database, so I don't need the first character of the string which encodes the length. If we remove the first character and encode the same blurHash in its equivalent raw bytes, we need only ~10 bytes (73 bits) to encode the hash, saving 1.5 MB on disk for 80,000 images. That may seem like a micro-optimization, especially in an RDBMS which may duplicate data in indexes. You could say I'm just allergic to plaintext formats when a more compact representation would do, and you'd be right :) I still think there's value in this approach though.

@jerry-git jerry-git added algorithm Relates to the BlurHash algorithm enhancement New feature or request labels Jun 10, 2022
@jagerman
Copy link

There definitely is merit in this: base83 is imposing the (severe) limitations of JSON binary encoding onto the user of the library, when the user of the library might be perfectly capable of representing binary data as binary data (as in the OP's case). Helpers for JSON/HTML compatibility are fine, but right now they are forced on everyone rather than only being forced on people who are themselves forced to deal with JSON's limitations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
algorithm Relates to the BlurHash algorithm enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants