Performance issue of Zip Class |
[eluser]stanleyxu[/eluser]
I use the following code to compress a folder. - When folder contains 1000 items, it takes 65secs - When folder contains 500 items, it takes 8secs. Code: $this->load->library('zip'); // zip object I think there is a bottleneck in Zip.php. I modified the source, after that: - When folder contains 1000 items, it takes 2secs - When folder contains 500 items, it takes 1secs. This issue has been reported in bug tracker as well. Full Source: Click Here
[eluser]stanleyxu[/eluser]
I have found another issue related to Zip class: When creating a Zip file, this class will cache the zip content in memory, which means double memory usage. Code: $this->zipfile = $data.$dir."\x50\x4b\x05\x06\x00\x00\x00\x00" Furthermore, Zip->archive($filepath) can be extended to Zip->archive($filepath, $volume=16384)....
[eluser]tonanbarbarian[/eluser]
default memory usage in PHP 4 is only 8M by default - 16+ is PHP5+
[eluser]stanleyxu[/eluser]
[quote author="tonanbarbarian" date="1202545911"]default memory usage in PHP 4 is only 8M by default - 16+ is PHP5+[/quote] Thanks for the info. 8M is even worse for compressing file, isn't it? That is why, i request to use my modification. ![]()
[eluser]Wilker[/eluser]
I'm sorry if I wrong... but... you leave this line commented: $gzdata = gzcompress($data); and this line is responsible to compress data... this way the data is zipping without compression... or no?
[eluser]Chris Newton[/eluser]
The next line encompasses that line $gzdata = substr(gzcompress($data), 2, -4); So it's being compressed.
[eluser]stanleyxu[/eluser]
[quote author="mahuti" date="1202595836"]Your URL seems to be down. Bummer.[/quote] Sorry, the server is unstable. [quote author="Wilker" date="1202602119"]I'm sorry if I wrong... but... you leave this line commented: $gzdata = gzcompress($data); and this line is responsible to compress data... this way the data is zipping without compression... or no?[/quote] It works, I just combined two lines as one Code: // ORIGINAL
[eluser]ocergyNohtna[/eluser]
thanks so much for this. my script went from 16 seconds to hardly 1. ![]() Code: $dir = 'foo'; Code: .\path Code: folder1
[eluser]stanleyxu[/eluser]
[quote author="ocergyNohtna" date="1202674559"]thanks so much for this. my script went from 16 seconds to hardly 1. ![]() Code: $dir = 'foo'; Code: .\path Code: folder1 Fortunately, yes ^^) I overrided Zip class Code: /** I am still tuning Unzip module. Stay tuned ![]() |
Welcome Guest, Not a member yet? Register Sign In |