recently I take a old project to rebuild.
I find the old source is so bad And I decide to reconsitution All project.
I try rewrite one module to test.
finnally I have Done coding and running this code in PHP5.6 environment and use xhprof to test performance to compare with old source.
but the new code's performance is not promote obviously. even cut down...
I find Top consume what is compose's autoload.
why??
OLD_SOURCE:
wt(wall time) 1,056,607 µs
cpu(cpu time) 370,198 µs
mu(memory useage) 6,342,688 bytes
NEW_SOURCE:
wt(wall time) 1,333,805 µs
cpu(cpu time) 868,354 µs
mu(memory useage) 3,668,944 bytes
As described.
In new Source
wallt time is up.
cpu time is up.
memory useage is down.
In details:
PDOStatement::execute
181,289 µs
Composer\Autoload\includeFile@1
156,924 µs
Composer\Autoload\includeFile
134,179 µs
file_exists
104,139 µs
In new code,I used MySQL PDO.
In old code,Is use MySQLi.
I can understand MySQLi fast to PDO.
but why
Composer\Autoload\includeFile@1
Composer\Autoload\includeFile
occupy more time to effected code??
and i find the func file_exists who is in Composer\Autoload\ClassLoader::findFileWithExtension
top3/4 question func in composer....