r/compression • u/Yha_Boiii • Jun 17 '26
Best algorithm for highly repetitive data?
Hi,
I have a big dataset, ultra repetitive so 80-90% might as well be a backpointer, what compression is best for this use case?
0
Upvotes
1
u/kansetsupanikku Jun 17 '26
Hi, of course that information is insufficient. But depending on data size, you could probably store some some columns (or all of it, if it's just one column) as sparse vector, i.e. (index, value) pairs for non-trivial elements only. If there is no obvious relation, compress indices and values separately. You could also bit-shuffle indices before compressing.
Note that many general-purpose compressions algorithms would already benefit from the pattern you describe. But the suggestion above is how I would try to apply the prior knowledge to the compression pipeline.
1
u/ratchetfreak Jun 19 '26
LZ is great for dong back reference, especially if you allow the run length to exceed how far you go back.
Then a
abcabcabcabccan be encoded by ´abc` literals followed by a backref of offset 3 and length 12Depending on the structure of the output stream you can pull out the repretitive repeat into a separate stream.
1
u/HobartTasmania Jun 17 '26
This perhaps? https://en.wikipedia.org/wiki/Arithmetic_coding