On my local system, the built-in PHP zip library is able to combine a 10-bit 24-megabyte zip file into a 21-bit 51 MB file in 800 ms, which is comparable to the 200 ms / file you reported, but I'm not sure how big your files are or what equipment you use.
Unlike the Java library that the author of your manual originally used, the PHP zip library is implemented in C, so you won’t see the same Java-C performance boost that the author saw. Having said that, I don’t know how Chillkat QuickAppend QuickAppend or how it compares with the PHP zip library, but it adds to the pre-compressed files, regardless of whether you do it with PHP or Chillkat, as if the fastest solution.
$destination = new ZipArchive; $source = new ZipArchive; if($source->open('a.zip') === TRUE && $destination->open('b.zip') === TRUE) { $time_start = microtime(true); $temp_dir = "/tmp/zip_" . time(); mkdir($temp_dir,0777,true); $source->extractTo($temp_dir); $source->close(); $files = scandir($temp_dir); $file_count = 0; foreach($files as $file) { if($file == '.' || $file == '..') continue; $destination->addFile("$temp_dir/$file"); ++$file_count; } $destination->close(); exec("rm -rf $temp_dir &"); $time_end = microtime(true); $time = $time_end - $time_start; print "Added $file_count files in " . ($time * 1000). "ms \n"; }
Exit
-rw-rw-r-- 1 fuzzytree fuzzytree 24020997 Jun 4 15:57 a.zip -rw-rw-r-- 1 fuzzytree fuzzytree 51418980 Jun 4 15:57 b.zip fuzzytree@atlas:~/testzip$ php zip.php Added 10 files in 872.43795394897ms fuzzytree@atlas:~/testzip$ ls -ltr *zip -rw-rw-r-- 1 fuzzytree fuzzytree 24020997 Jun 4 15:57 a.zip -rw-rw-r-- 1 fuzzytree fuzzytree 75443030 Jun 4 15:57 b.zip
Fuzzytree
source share