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

Add lzwCompress.js and lz-string to the benchmarks #4

Open
J3m5 opened this issue Aug 30, 2021 · 3 comments
Open

Add lzwCompress.js and lz-string to the benchmarks #4

J3m5 opened this issue Aug 30, 2021 · 3 comments

Comments

@J3m5
Copy link

J3m5 commented Aug 30, 2021

It would be nice to be able to compare your library to those:
https://github.com/floydpink/lzwCompress.js
https://github.com/pieroxy/lz-string

Would it be possible to add them to the benchmarks ?
Thanks

@beenotung
Copy link
Owner

Good suggestion, you can add tests (benchmark) for these library following the tests in

test(
'JSON',
o => JSON.stringify(o),
c => JSON.parse(c),
)
const cjson = require('compressed-json')
test(
'compressed-json',
o => cjson.compress(o),
c => cjson.decompress(c),
)
// too slow
const jsonpack = require('jsonpack')
test(
'jsonpack',
o => jsonpack.pack(o),
c => jsonpack.unpack(c),
)
test(
'compress-json',
o => compress(o),
c => decompress(c),
)

@beenotung
Copy link
Owner

beenotung commented Aug 31, 2021

lz-string seems to be binary compression, may not be fair comparison (because the underline storage engine may need to escape binary string before storing them which can add the storage size significantly);

I do not have access to the original sample data at the moment. Just did a trial with lzwcompress on another 50k sample data from the same online forum dataset.

Number of sample object: 50,000

- JSON compressed-json compress-json lzwcompress
Compressed Size 45M 36M 34M 42M
Compress Time 197ms 1.6s 2.6s 6.3s
Decompress Time 274ms 569ms 1.6s 560ms
Exact Match* Yes No Yes No

Remark: exact match consider whevether the order of object key is preserved when decompressed from the compressed representation.

@J3m5
Copy link
Author

J3m5 commented Sep 1, 2021

In fact, the one I was the most interested in is lz-string.
I'll look into it, thank you very much!

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

2 participants