PHPOffice / Common

Shared components between all PHPOffice projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dependence of PclZip

wapmorgan opened this issue · comments

Hello. I see all your projects dependence on this package and this package use pclzip. I think pclzip is very slow solution in case of managing zip-archives. As alternative for this I can support using my package (https://github.com/wapmorgan/UnifiedArchive). It provides all needed functions to work with zip archives with very big speed gain (comparing to PclZip). Also, you don't need to change all things that work with archives, only initiation part. Let me show.
It provides PclZip-like interface for ZIP archives, so all you need is to change PclZip initiation

$archive = new PclZip("archive.zip");

to UA initiation and receiving PclZip-interface

$archive = UnifiedArchive::open('ziparchive.zip')->pclzipInteface();

That's all! After that speed of all archive operations will increase.

Take your time to think that and I can help you test your products and replace old requirements with modern ones.

To approve my words about PclZip oldness there's results of some benchmark. I took few popular projects on Github as zip-archives and few my archives and tested full extraction with UnifiedArchive and PclZip.
To avoid storage latency impact on test I used in-memory disk (imDisk) for Windows and created a 3Gb virtual hard drive, copied all archives to it and start testing (avg write/read speed is 3Gb/sec).

My results are:
1st run

Filename UA (time) % of PZ PZ (time) UA (mem) % of PZ PZ (mem)
googletools.zip 0.047 86% 0.054 1.18m 99% 1.18m
PHPWord-develop.zip 1.030 43% 2.344 1.3m 109% 1.19m
turbosale_1.0.0.zip 0.545 66% 0.817 1.23m 103% 1.19m
meteor-devel.zip 11.237 86% 12.968 1.76m 148% 1.19m
subrion-develop.zip 19.045 92% 20.684 2.03m 171% 1.19m
OptiKey-master.zip 3.257 85% 3.807 1.34m 112% 1.19m

UA is 24% faster

2nd run

Filename UA (time) % of PZ PZ (time) UA (mem) % of PZ PZ (mem)
googletools.zip 0.042 83% 0.051 1.18m 99% 1.19m
PHPWord-develop.zip 0.876 43% 2.007 1.3m 109% 1.19m
turbosale_1.0.0.zip 0.537 75% 0.714 1.23m 103% 1.19m
meteor-devel.zip 10.032 83% 11.964 1.76m 148% 1.19m
subrion-develop.zip 15.329 86% 17.772 2.03m 171% 1.19m
OptiKey-master.zip 3.023 79% 3.791 1.34m 112% 1.19m

UA is 26% faster

and 3rd run

Filename UA (time) % of PZ PZ (time) UA (mem) % of PZ PZ (mem)
googletools.zip 0.037 77% 0.048 1.18m 99% 1.19m
PHPWord-develop.zip 0.897 43% 2.065 1.3m 109% 1.19m
turbosale_1.0.0.zip 0.530 73% 0.726 1.23m 103% 1.19m
meteor-devel.zip 10.424 85% 12.230 1.76m 148% 1.19m
subrion-develop.zip 15.425 83% 18.406 2.03m 171% 1.19m
OptiKey-master.zip 3.102 83% 3.716 1.34m 112% 1.19m

UA is 26% faster

Average growth is 26% when storage latency is very low!

If test the same archives on usual HDD (avg read speed is 120mb/sec), I get that result:

Filename UA (time) % of PZ PZ (time) UA (mem) % of PZ PZ (mem)
googletools.zip 0.014 67% 0.020 1.18m 99% 1.19m
PHPWord-develop.zip 0.573 63% 0.907 1.3m 109% 1.19m
turbosale_1.0.0.zip 0.250 80% 0.309 1.23m 103% 1.19m
meteor-devel.zip 6.553 62% 10.429 1.76m 148% 1.19m
subrion-develop.zip 10.682 82% 12.996 2.03m 171% 1.19m
OptiKey-master.zip 3.445 82% 4.180 1.34m 112% 1.19m

UA is 28% faster

@wapmorgan Don't hesitate to create a PR for adding an adapter for UnifiedArchive : https://github.com/PHPOffice/Common/tree/develop/src/Common/Adapter/Zip :)

Ok, then this issue can be closed.