-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add config for compressing options before chrome.sync.set #31
Comments
Indeed, it looks like that's what they're using: chrome.storage.sync.getBytesInUse(console.log)
// -> 4256
chrome.storage.sync.get(data => console.log(JSON.stringify(data).length))
// -> 4261 This library is pretty small: https://bundlephobia.com/result?p=lz-string@1.4.4 I tried compressing my Refined GitHub options and that number went down to 850 bytes, which is pretty good. It should probably be enabled by default. The compression takes 7ms on RunKit and the decompression about 2ms. |
sweet! feel free to assign to me. I think I'll have some time |
Sure, if you have time it would be great. It should probably be enabled by default but it should still be able to read the uncompressed options to allow an easy migration of existing users. Then the options can be compressed on the successive save |
This comment has been minimized.
This comment has been minimized.
Hi, first and foremost - thanks for this awesome little package! 👍 I am using compressToEncodedURIComponent - as I found that the compression rate was actually higher for js objects. What do you think? |
Fixed by #40 Available in v1.2.0 |
Thanks for all these awesome webext libraries!
The sync.set serialization isn't the most transparent, but from what it sounds like it might be something like JSON.stringify
The storage.sync capacity is 100Kb so I think the smaller the better here.
Could use something like lz-string + JSON.stringify to seriazlize + compress / decompress + deserialize the options map
The text was updated successfully, but these errors were encountered: