unknownbrackets / maxcso

Fast cso compressor
ISC License
390 stars 23 forks source link

Disadvantages of higher compression levels on loading times? #78

Closed aidinzolghadr closed 1 year ago

aidinzolghadr commented 1 year ago

Hi,

Does using different compression methods differ in game's loading times as well? Or they just take more time to compress?

In other words, which compression method gives the best bang for the buck in terms of file size and loading times when playing the files in emulators?

I don't care how long does it take to compression an ISO, I just want the smallest file while having almost no difference than raw ISO when playing it.

(Sorry for asking this, I can't test this as thoroughly as I want.)

Cheers

unknownbrackets commented 1 year ago

Generally, deflate decompresses at about the same speed regardless of compression level. As noted in the README:

maxcso always uses compression level 9. Decompression speed is about the same regardless of level, and disk access is faster with smaller files.

Note this isn't always true of all types of compression, but it is true of the type of compression CSOs use.

Level mainly just impacts compression speed. And because smaller files read faster and take less memory to cache, higher compression levels can actually improve read speed. That said, the effect of this is very small on modern devices, especially with flash or SSD storage.

Just as an example, PCSX2 has a complicated caching mechanism for some of the compressed formats it supports. When CSO reading was implemented, initially the same caching mechanism was ported over - but it actually got in the way and just made things slower. Decompressing CSO was fast enough that all the extra work the cache was doing wasn't worth it. Decompressing CSOs is very fast, and PCSX2 ended up with a very simple cache in its CSO implementation for this reason.

-[Unknown]