Skip to content

Instantly share code, notes, and snippets.

@beberlei
Last active June 16, 2018 10:55
Show Gist options
  • Save beberlei/ddaad1323163b3c28148f61c7ae2b44c to your computer and use it in GitHub Desktop.
Save beberlei/ddaad1323163b3c28148f61c7ae2b44c to your computer and use it in GitHub Desktop.
Composer Rule2Literal Memory Perf Improvement under Memory Allocation Profiler
composer.5b24d70e04636.xhprof v1.3.3
main() 7539911.00 KB alloc / pmu 2607561.50 KB
Showing XHProf data by Exclusive Amount of allocated Memory
+------------------------------------------------------------------+---------+---------------+--------------------------------+-----------------------+
| FUNCTION | COUNT | ALLOC AMOUNT | EXCL ALLOC AMOUNT (>= | EXCLUSIVE PEAK MEMORY |
| | | | 13246.06 KB) | |
+------------------------------------------------------------------+---------+---------------+--------------------------------+-----------------------+
| Composer\DependencyResolver\RuleSetGenerator::createConflictRule | 3170298 | 1398910.00 KB | 1324605.88 KB | 713857.00 KB |
| unpack | 3187450 | 1170391.88 KB | 1170391.88 KB | 630592.38 KB |
| Composer\DependencyResolver\RuleSet::add | 3187450 | 2596020.00 KB | 1021251.50 KB | 245728.94 KB |
| json_decode | 350 | 870091.12 KB | 870091.12 KB | 278996.94 KB |
| Composer\DependencyResolver\RuleWatchGraph::insert | 1956891 | 767708.81 KB | 614802.75 KB | 186370.53 KB |
| file_get_contents | 354 | 522507.53 KB | 522507.41 KB | 8532.16 KB |
| implode | 3264755 | 262368.22 KB | 262368.22 KB | 98912.45 KB |
| Composer\DependencyResolver\Pool::computeWhatProvides | 6193 | 2175905.50 KB | 187193.09 KB | 23372.59 KB |
| Composer\DependencyResolver\Solver::solve | 2 | 7481363.50 KB | 168171.39 KB | -0.17 KB |
| SplDoublyLinkedList::unshift | 3916445 | 152986.38 KB | 152986.38 KB | 152624.16 KB |
| md5 | 3187453 | 149412.41 KB | 149412.41 KB | 28012.95 KB |
| Composer\DependencyResolver\RuleSetGenerator::createRequireRule | 16911 | 180435.44 KB | 118868.27 KB | 58912.30 KB |
| SplQueue::enqueue | 2626890 | 102613.14 KB | 102613.14 KB | 750.11 KB |
| Composer\DependencyResolver\Pool::match | 815586 | 271060.78 KB | 97576.59 KB | 534.73 KB |
| substr | 2402980 | 79709.08 KB | 79709.08 KB | 185.77 KB |
| Composer\DependencyResolver\Rule::__construct | 3187450 | 136038.58 KB | 74787.20 KB | 42535.33 KB |
| array_merge | 3706 | 67425.74 KB | 67425.74 KB | 26944.20 KB |
| str_replace | 2254905 | 63428.60 KB | 63428.60 KB | 300.73 KB |
| sort | 3187595 | 61301.44 KB | 61301.44 KB | 79783.65 KB |
| zlib_decode | 4 | 53539.55 KB | 53539.55 KB | 1833.06 KB |
| Composer\Package\Loader\ArrayLoader::parseLinks | 40336 | 61313.77 KB | 43067.56 KB | 4459.97 KB |
| version_compare | 1127029 | 39817.84 KB | 39817.84 KB | 79.03 KB |
| array_filter | 16243 | 32513.98 KB | 32512.86 KB | 874.53 KB |
| Composer\Repository\ComposerRepository::createPackage | 20090 | 148335.92 KB | 25263.80 KB | 43.20 KB |
| Composer\Autoload\includeFile | 158 | 30098.86 KB | 24145.40 KB | 5829.97 KB |
| Composer\Semver\Constraint\MultiConstraint::__toString | 54804 | 47113.95 KB | 23945.36 KB | 2213.66 KB |
| Composer\Package\Loader\ArrayLoader::load | 20298 | 119672.39 KB | 23454.05 KB | 767.02 KB |
| preg_match | 129899 | 20844.57 KB | 20844.57 KB | 763.05 KB |
+------------------------------------------------------------------+---------+---------------+--------------------------------+-----------------------+
Showing XHProf data by Exclusive Memory
+------------------------------------------------------------------+---------+---------------+-------------------------------+
| FUNCTION | COUNT | MEMORY | EXCL MEMORY (>= 14920.29 KB) |
+------------------------------------------------------------------+---------+---------------+-------------------------------+
| Composer\DependencyResolver\RuleSetGenerator::createConflictRule | 3170298 | 1492029.62 KB | 1492029.38 KB |
| unpack | 3187450 | 1269999.75 KB | 1269999.75 KB |
| Composer\DependencyResolver\RuleSet::add | 3187450 | 923264.69 KB | 923263.81 KB |
| json_decode | 350 | 805177.75 KB | 805177.75 KB |
| Composer\DependencyResolver\Solver::solve | 2 | 2598012.00 KB | 183457.72 KB |
| implode | 3264753 | 161636.03 KB | 161636.03 KB |
| SplDoublyLinkedList::unshift | 3916445 | 152986.38 KB | 152986.38 KB |
| md5 | 3187453 | 149412.41 KB | 149412.41 KB |
| file_get_contents | 354 | 142784.73 KB | 142784.61 KB |
| SplQueue::enqueue | 2626890 | 102613.14 KB | 102613.14 KB |
| sort | 3187595 | 94174.40 KB | 94174.40 KB |
| substr | 2403001 | 81047.07 KB | 81047.07 KB |
| array_merge | 3704 | 68926.59 KB | 68926.59 KB |
| str_replace | 2254905 | 63407.77 KB | 63407.77 KB |
| Composer\Package\Loader\ArrayLoader::parseLinks | 40336 | 43870.61 KB | 42040.96 KB |
| array_filter | 16243 | 23137.04 KB | 23135.91 KB |
| preg_match | 129755 | 22259.59 KB | 22259.59 KB |
| Composer\Package\Loader\ArrayLoader::load | 20298 | 66344.62 KB | 15422.24 KB |
| RecursiveDirectoryIterator::getChildren | 1886 | 15838.77 KB | 15279.30 KB |
+------------------------------------------------------------------+---------+---------------+-------------------------------+
composer.5b24d74fc12a2.xhprof v1.4.0
main() 8597111.00 KB alloc / pmu 1207599.50 KB
+-------------------------------------------------------------------+---------+---------------+--------------------------------+-----------------------+
| FUNCTION | COUNT | ALLOC AMOUNT | EXCL ALLOC AMOUNT (>= | EXCLUSIVE PEAK MEMORY |
| | | | 27447.08 KB) | |
+-------------------------------------------------------------------+---------+---------------+--------------------------------+-----------------------+
| Composer\DependencyResolver\Rule2Literals::getLiterals | 8783064 | 2744708.00 KB | 2744708.00 KB | 181481.97 KB |
| unpack | 3187450 | 1170392.00 KB | 1170392.00 KB | 130042.93 KB |
| json_decode | 350 | 870240.44 KB | 870240.44 KB | 278277.22 KB |
| Composer\DependencyResolver\RuleWatchGraph::insert | 1956891 | 767708.94 KB | 614802.75 KB | 4637.11 KB |
| Composer\DependencyResolver\Rule2Literals::getHash | 3170298 | 1733757.12 KB | 421055.41 KB | 50.26 KB |
| Composer\DependencyResolver\RuleSet::add | 3187450 | 2564434.25 KB | 409868.25 KB | 240011.67 KB |
| Composer\DependencyResolver\RuleSetGenerator::createRule2Literals | 3170298 | 383487.38 KB | 383423.62 KB | 27641.02 KB |
| file_get_contents | 354 | 309997.91 KB | 309997.78 KB | 8013.01 KB |
| Composer\DependencyResolver\Pool::computeWhatProvides | 6193 | 1919246.00 KB | 187193.14 KB | 16101.48 KB |
| Composer\DependencyResolver\Solver::solve | 2 | 8537691.00 KB | 168171.22 KB | -0.05 KB |
| SplDoublyLinkedList::unshift | 3916445 | 152986.38 KB | 152986.38 KB | 152501.62 KB |
| md5 | 3187453 | 149412.53 KB | 149412.53 KB | 0.00 KB |
| Composer\DependencyResolver\RuleSetGenerator::createRequireRule | 16911 | 180497.67 KB | 118868.27 KB | 46869.30 KB |
| SplQueue::enqueue | 2626890 | 102613.14 KB | 102613.14 KB | 285.62 KB |
| Composer\DependencyResolver\Pool::match | 815586 | 271060.78 KB | 97576.59 KB | 339.95 KB |
| substr | 2402989 | 79709.53 KB | 79709.53 KB | 140.67 KB |
| array_merge | 3702 | 67425.52 KB | 67425.52 KB | 26901.09 KB |
| str_replace | 2254905 | 63428.60 KB | 63428.60 KB | 203.01 KB |
| sort | 17297 | 61301.44 KB | 61301.44 KB | 67672.40 KB |
| Composer\Package\Loader\ArrayLoader::parseLinks | 40336 | 61841.77 KB | 43787.56 KB | 4668.02 KB |
| version_compare | 1127029 | 39817.84 KB | 39817.84 KB | 56.52 KB |
| implode | 94485 | 36363.69 KB | 36363.69 KB | 450.93 KB |
| array_filter | 16245 | 32514.61 KB | 32513.48 KB | 870.44 KB |
+-------------------------------------------------------------------+---------+---------------+--------------------------------+-----------------------+
Showing XHProf data by Exclusive Memory
+-------------------------------------------------------------------+---------+---------------+-------------------------------+
| FUNCTION | COUNT | MEMORY | EXCL MEMORY (>= 32250.32 KB) |
+-------------------------------------------------------------------+---------+---------------+-------------------------------+
| Composer\DependencyResolver\Rule2Literals::getLiterals | 8783064 | 3225032.00 KB | 3225032.00 KB |
| unpack | 3187450 | 1269999.88 KB | 1269999.88 KB |
| json_decode | 350 | 805325.50 KB | 805325.50 KB |
| Composer\DependencyResolver\RuleSetGenerator::createRule2Literals | 3170298 | 377480.19 KB | 377471.47 KB |
| Composer\DependencyResolver\RuleSet::add | 3187450 | 205061.38 KB | 205059.38 KB |
| Composer\DependencyResolver\Solver::solve | 2 | 1197845.00 KB | 183458.22 KB |
| SplDoublyLinkedList::unshift | 3916445 | 152986.38 KB | 152986.38 KB |
| md5 | 3187453 | 149412.53 KB | 149412.53 KB |
| file_get_contents | 354 | 136258.11 KB | 136257.98 KB |
| SplQueue::enqueue | 2626890 | 102613.14 KB | 102613.14 KB |
| sort | 17297 | 94174.40 KB | 94174.40 KB |
| substr | 2403037 | 81048.66 KB | 81048.66 KB |
| array_merge | 3718 | 68926.16 KB | 68926.16 KB |
| str_replace | 2254905 | 63407.77 KB | 63407.77 KB |
| Composer\Package\Loader\ArrayLoader::parseLinks | 40336 | 44134.61 KB | 42400.96 KB |
+-------------------------------------------------------------------+---------+---------------+-------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment