Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Code profiling with Xdebug and Kcachegrind
robertbasic
January 28, 2017
Programming
0
72
Code profiling with Xdebug and Kcachegrind
Slides for an uncon talk I gave at phpbnl17
robertbasic
January 28, 2017
Tweet
Share
More Decks by robertbasic
See All by robertbasic
robertbasic
1
640
robertbasic
1
25
robertbasic
0
80
robertbasic
1
230
robertbasic
0
94
robertbasic
1
120
robertbasic
1
140
robertbasic
4
290
robertbasic
2
100
Other Decks in Programming
See All in Programming
grapecity_dev
0
170
heistak
2
120
mackee
0
500
takahi5
1
390
williln
0
210
neripark
3
560
mehowte
0
180
makomakok
0
110
mploed
3
160
sters
2
120
christianliebel
PRO
0
130
s103ng
0
240
Featured
See All Featured
dougneiner
119
7.9k
chrislema
173
14k
philnash
9
580
andyhume
64
3.7k
carmenhchung
30
1.5k
jensimmons
207
10k
jakevdp
774
200k
geoffreycrofte
21
920
sachag
446
36k
michaelherold
224
8.5k
robhawkes
52
2.8k
reverentgeek
168
7.2k
Transcript
Robert Basic ~ phpbenelux17 Code profiling with Xdebug and KCachegrind
Robert Basic https://robertbasic.com/ @robertbasic
Robert Basic ~ phpbenelux17 Tools of the trade Xdebug •
Not just for debugging KCachegrind • Visualizing profiling data
Robert Basic ~ phpbenelux17 What’s the fastest code?
Robert Basic ~ phpbenelux17 The code that’s not called!
Robert Basic ~ phpbenelux17 Number of calls
Robert Basic ~ phpbenelux17 Who’s to blame?
Robert Basic ~ phpbenelux17 Which was called by another method
Robert Basic ~ phpbenelux17 Which was called by another method
Robert Basic ~ phpbenelux17 So many callers!
Robert Basic ~ phpbenelux17 A graph to see it
Robert Basic ~ phpbenelux17 Context to understand it
Robert Basic ~ phpbenelux17 Fix it This is really up
to you
Robert Basic ~ phpbenelux17 Tips for fixing performance issues •
Biggest impact, least effort • Profile after every change • Avoid over-optimizing • Learn to EXPLAIN
Robert Basic ~ phpbenelux17 Tips 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 ~ phpbenelux17 Other tools • WinCacheGrind, Webgrind •
XHProf • Blackfire.io
Robert Basic ~ phpbenelux17 Thanks! Questions?