I have an object I am trying to compress. It is of the form
[
{
array
string
},
{
array
string
},
...
]
The arrays are no more than 10-15 in length, extremely small in comparison to the strings (they are html, roughly 170k in length). The strings though are usually repeated, or have huge amounts of overlap. So my intuition tells me the compressed value should be the compress value of 1 string, plus a little extra.
I JSON.stringify this object and try to compress.
Most compression libraries did a bad job of compressing the strings, since the server sends me a gzip compressed version of 77kb, I know it can be at least this small.
gzip-js
lzma-js
Did a good job out of the maybe 15 libraries I tried.
The issue is gzip-js is linear in the number of strings. But lzma does this correctly, where it only increases in size slightly.
Lzma-js(level 2) is very slow unfortunately(20s vs 1s gzip) when compressing 7mbs(about 30~ strings).
Is there a compressopn library out there, that is roughly as quick as gzip, but doesn't scale linearly on repeat strings?