-
Notifications
You must be signed in to change notification settings - Fork 62
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
env-web: LZString-like compression #82
Comments
this is not as easy as expected, cause we need access to UTF16 strings, but strings in Rust, including what's returned from we could compromise and use utf8 strings, but that may create further issues |
using The only option seems to be getting JSString and using |
|
Results with UTF8: https://github.com/Stremio/stremio-core-example/commit/3e99f89af07378dce7c0a916ad69175c757acdd0 compression 212ms 282261 104904 62.83% savings Takes a while to compress this half a megabyte..I'm pretty sure it can be optimized ; the lz-string crate does seem pretty immature in comparison, the JS version here, did: The byte size checks out cause it's 2x cause of utf8 Time: Size:1139260 bytes |
much better results with flate2: compression 48ms 569566 115723 79.68% savings Although we're producing invalid utf8 so that's not a real solution |
Two realistic solutions:
A key insight here is that we can't use invalid UTF8, cause of the transcoding process involved (TextEncoder/TextDecoder); producing actual valid UTF8 might be expensive(ish) |
Another option would be to use IndexedDB, which supports binary data |
actually, using IndexedDB with binary data directly from Rust might improve performance, and remove the need for compression altogether! So this issue could be replaced by implementing IndexedDB |
Closing in favor of https://github.com/Stremio/stremio-core/issues/83 |
feat(serialize_player): serialize stream_state
see:
http://jsfiddle.net/yshadmehr/gzd52hh1/
https://github.com/adumbidiot/lz-string-rs
http://pieroxy.net/blog/pages/lz-string/index.html
https://github.com/pieroxy/lz-string
The point is, by using the full UTF16 character space that JavaScript supports, plus LZMA compression, we can end up with using only 10-20% of the original storage space required
Conclusion: after some research (see below), this will be put on the back burner for now and revisited before the 5.x release
The text was updated successfully, but these errors were encountered: