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

LZ4 compared to LZ-string ? #142

Open
Extarys opened this issue Dec 31, 2019 · 3 comments
Open

LZ4 compared to LZ-string ? #142

Extarys opened this issue Dec 31, 2019 · 3 comments

Comments

@Extarys
Copy link

Extarys commented Dec 31, 2019

There are some nice benchmark for LZ4 here but I'm not a pro of compression.

I'm looking for a way to store objects for a web extension and since lz-string was primary developed for this, I'm tempted to use it, but I was wondering if there was a good point in using lz4 (wasm)?

@pieroxy
Copy link
Owner

pieroxy commented Aug 13, 2021

LZ-String is specifically tailored to compress a string into another string, making the best use of the UTF-16 encoding. If you can store other type of data (uint8array, etc.) then it makes sense to use a library that will return this kind of data.

LZ4 should provide the same compression level but should be much faster.

@gblazex
Copy link

gblazex commented Jan 12, 2022

@pieroxy

My question is if you plan to release the 15bit character encoding as a separate project?
How hard would it be?

As you noted on your page some browsers might have problems with arbitrary 16bit characters shoved into localStorage.
This library solves that problem but only for the current compression algo.

A more general solution would be welcome to allow any binary data to be efficiently stored into such places with your excellent 15bit encoding. This would work well with other compression outputs and even binary images.

Yes there are other solutions for binary data (like IndexDB) but I found that some browsers (e.g. Safari) have way better performance when reading from localStorage during the initial rendering of the page. So for first paint critical resources this would be very helpful.

@gblazex
Copy link

gblazex commented Jan 13, 2022

I found a library for it

https://github.com/qntm/base32768/

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

No branches or pull requests

3 participants