Speed up archive unpacking performance#36
Conversation
|
Thank you for your PR. Performance improvements like these are very welcome. Looking at the code on a first glance however, I'm not entirely sure if this would still produce the correct results. I only looked at the gzip code so far and to me it looks as if the substr() calls in line 174 and 190 are actually necessary, otherwise it would read to much data, right? I'll have another look into this soon. |
|
I've done a performance test by extracting the Joomla 5.0.2 tar.gz package using the following simple script (and extracting to use Joomla\Archive\Archive;
ini_set('memory_limit', '256M'); // PHP's default 128M limit is not sufficient to store unzipped tar
require __DIR__ . '/vendor/autoload.php';
(new Archive())->extract($argv[1], $argv[2]);The results are below: Fantastic 158x speedup! PS. I've run the patched version before the original to avoid replies like "your patched version uses a warmed file cache". PPS. This test was run on PHP 8.1 with the |
|
Thank you! |
Summary of Changes
Speed up archive unpacking performance by using
offsetargument inunpack(instead ofsubstr).Testing Instructions
Run
phpunitto check if all tests have passed.Documentation Changes Required
None.