[physfs] 7z/lzma in trunk

Ryan C. Gordon icculus at icculus.org
Wed Sep 27 10:06:06 EDT 2006


> After I hardfixed the CRC calculation I tested with random access on 2 files.
> Was very slow, too. Even more than expected... I'll use multiple caches in the 
> next version...

Generally speaking, it's not worth going out of the way to optimize 
random access to formats that don't support it, like zipfiles, which 
have to decompress the whole file to get to the seek point...I assume 
lzma has the same problem.

The solution is usually to cache the decompressed file in RAM inside 
PhysicsFS, but this is basically unacceptable on low-memory systems like 
the PlayStation 2...especially considering that most apps do not seek 
randomly through a file, or seek at all. Games and apps that need to 
deal with a slow file can just as easily cache the data through 
PHYSFS_read() without adding complexity or resource usage to the library.

So if the solution is "cache more," I'd encourage you to leave it as a 
slow operation. If there was a fast way to jump to roughly the correct 
location in the compressed stream and then figure out the right 
plaintext offset by uncompressing a block or two of data, that would be 
a win, but that's not usually possible.

(10 minutes to read 100 kilobytes of sequential data would be a problem 
worth optimizing though!)

--ryan.




More information about the physfs mailing list