[wp-trac] [WordPress Trac] #10779: optimised unzip_file()
WordPress Trac
wp-trac at lists.automattic.com
Wed Jan 20 08:41:40 UTC 2010
#10779: optimised unzip_file()
-------------------------+--------------------------------------------------
Reporter: dd32 | Owner: dd32
Type: enhancement | Status: accepted
Priority: normal | Milestone: 3.0
Component: Filesystem | Version: 2.9
Severity: normal | Keywords: needs-patch
-------------------------+--------------------------------------------------
Comment(by dd32):
Just did some benchmarks on the code.
First item is an array of the number of times each function is called.
Then a total of the calls:
{{{
Before:
array(6) {
["connect"]=>
int(1)
["mkdir"]=>
int(83)
["put_contents"]=>
int(753)
["exists"]=>
int(836)
["chmod"]=>
int(836)
["is_dir"]=>
int(1754)
}
Total: 4263
After:
array(6) {
["connect"]=>
int(1)
["is_dir"]=>
int(3)
["mkdir"]=>
int(83)
["put_contents"]=>
int(753)
["exists"]=>
int(836)
["chmod"]=>
int(836)
}
Total: 2512
}}}
is_dir() is expensive on FTP systems, and all of those exists() calls can
be removed by letting chmod() either suceed, or fail. instead of checking
if it'll fail (if it exists) and then letting it either suceed or fail.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/10779#comment:9>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list