flat assembler
Message board for the users of flat assembler.

Index > Windows > Compression algorithms

Author
Thread Post new topic Reply to topic
Fastestcodes



Joined: 13 Jun 2022
Posts: 75
Fastestcodes
What is the best lossless compression algo?
Post 07 Jul 2022, 12:24
View user's profile Send private message Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 1888
Furs
Depends on what you want it for (compression ratio? speed? balance between the 2?), and also the input data.

If you want something ultra fast while still having decent compression for very redundant data, use LZ4. There's almost no reason to use uncompressed data with it around.

zstd is very popular nowadays because it's very fast while offering good compression ration (better than zlib at highest settings), but it doesn't compress as well as XZ/LZMA.

zlib imo should be deprecated since zstd is objectively superior to it, and bzip is just bad.

But these are just the mainstream ones. There's always obscure ones from hobbyists or whatnot that probably have even better compression. If you want to use them in a project I mean, not for archiving your files.


They're general-purpose algorithms though. For audio, for example, you have specialized lossless algos that perform better, such as wavpack (which is objectively better than flac, despite the latter being popular).
Post 07 Jul 2022, 12:40
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18846
Location: In your JS exploiting you and your system
revolution
The "best" is subjective.

Perhaps the only real best is the one you use the most. It might not be the fastest, or create the smallest output, or be the most efficient, but if you use it then it must have some form of best-ness. Maybe because it is the most compatible, or has the easiest interface, or just simply be the most popular.

Theoretically you could have some super-amazing algorithm that gives 20% smaller outputs than all other algorithms, but if it takes a week to compress a 1kB file then it would be useless for general purpose usage.

Also theoretically you can "compress" an image with infinite complexity into an output of small finite size. The Mandelbrot set is an example of that. An entire infinitely complex image can be expressed as z(n+1) = z(n)^2 + C.

You can also compress pre-determined outputs to zero size with a simple algorithm. So you can make a dedicated Shakespeare-compression-algorithm like this:
1. If input size is zero bytes then output the entire works of Shakespeare; else
2. Use gunzip to decode the input.
Post 07 Jul 2022, 20:44
View user's profile Send private message Visit poster's website Reply with quote
Furs



Joined: 04 Mar 2016
Posts: 1888
Furs
revolution wrote:
The "best" is subjective.
Actually it's not. It's a quantifiable objective fact. But of course it depends on what you want it best at, as you mentioned a few of them. All of those things are quantifiable though.
Post 08 Jul 2022, 13:04
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 18846
Location: In your JS exploiting you and your system
revolution
Furs wrote:
revolution wrote:
The "best" is subjective.
Actually it's not. It's a quantifiable objective fact. But of course it depends on what you want it best at, as you mentioned a few of them. All of those things are quantifiable though.
I think you misunderstand the meaning of subjective.

What I outlined, and what you outlined, and what I highlighted in your response, clearly show it is subjective.

Subjectivity, a subject's personal perspective, feelings, beliefs, desires or discovery, as opposed to those made from an independent, objective, point of view
Post 08 Jul 2022, 17:57
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.