microsoft / tolerant-php-parser

An early-stage PHP parser designed for IDE usage scenarios.
MIT License
884 stars 80 forks source link

CPU profiling to identify potential performance improvements #15

Open mousetraps opened 7 years ago

mousetraps commented 7 years ago

Also any suggestions for tools? There's xdebug + webgrind... any other favorite workflows?

nicolas-grekas commented 7 years ago

https://blackfire.io/, what else ;)

Blackfire is the PHP profiler I develop with my team. It does extended raw data gathering, callgraph based visualizations, and continuous integration for automated performance testing (thus could help #8 also). I'd be happy to help start with it and provide a premium or enterprise plan if needed.

mousetraps commented 7 years ago

@nicolas-grekas haven't used it before, so that would be amazing! I have a hunch there are some very simple improvements we could make in some core areas like parseList that would have a pretty significant impact on perf, so it would be awesome to identify those hot spots.

I would also be interested in learning more about their perf test infrastructure and what the variance is like - their docs don't seem to make any references to basic statistical techniques, so it's worth investigating, but I'm pretty skeptical about relying on it for anything beyond getting a general sense for a trend over time.

Also re: memory see #13 - it would be great to understand what Node types we could optimize for the greatest perf boost (e.g. we probably want to minimize empty properties or sparse arrays on common node kinds)

TysonAndre commented 5 years ago

https://github.com/adsr/phpspy is another useful tool - it allows generating flame graphs of the time spent in each function and has low overhead.

Making sure all constant accesses and function invocations are fully qualified would be a small boost to performance - The major issues such as #283 should have already been identified, though. https://github.com/phan/phan/blob/master/.phan/plugins/NotFullyQualifiedUsagePlugin.php can be used to do that.