Slides for an uncon talk I gave at phpbnl17
Robert Basic ~ phpbenelux17Code profiling withXdebug and KCachegrindRobert Basichttps://robertbasic.com/@robertbasic
View Slide
Robert Basic ~ phpbenelux17Tools of the tradeXdebug● Not just for debuggingKCachegrind● Visualizing profiling data
Robert Basic ~ phpbenelux17What’s the fastest code?
Robert Basic ~ phpbenelux17The code that’s not called!
Robert Basic ~ phpbenelux17Number of calls
Robert Basic ~ phpbenelux17Who’s to blame?
Robert Basic ~ phpbenelux17Which was called by another method
Robert Basic ~ phpbenelux17So many callers!
Robert Basic ~ phpbenelux17A graph to see it
Robert Basic ~ phpbenelux17Context to understand it
Robert Basic ~ phpbenelux17Fix itThis is really up to you
Robert Basic ~ phpbenelux17Tips for fixing performance issues● Biggest impact, least effort● Profile after every change● Avoid over-optimizing● Learn to EXPLAIN
Robert Basic ~ phpbenelux17Tips for using Xdebug and KCachegrind● Xdebug– xdebug.profiler_output_dir– xdebug.profiler_output_name– cachegrind.out.%t.%R– Xdebug lies!● KCachegrind– Install graphviz– Use % relative– Turn on Cycle detection– Settings > Configure KCachegrind > Annotations > Add source folder
Robert Basic ~ phpbenelux17Other tools● WinCacheGrind, Webgrind● XHProf● Blackfire.io
Robert Basic ~ phpbenelux17Thanks!Questions?