SlideShare a Scribd company logo
PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org PHP & Javascript Profiling Dave Ross The West Suburban Chicago PHP Meetup March 5, 2009
PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Dave Ross “ I grew up around computers, fell in love with the Internet way back in 1994, and built a successful career around my interests in computers and business. My career focus has been on e-commerce, and in my personal time I study issues related to digital identity, trust, and reputation tracking. I’m also a cat shelter volunteer, a small business owner, an avid Scrabble player, a vintage computer enthusiast, and a b-movie junkie.” Ten years professional development experience. PHP Developer, certified Java developer LinkedIn Profile: http://www.linkedin.com/in/daverossfromchicago
PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Software Profiling In software engineering, performance analysis, more commonly today known as profiling, is the investigation of a program's behavior using information gathered as the program executes (i.e. it is a form of dynamic program analysis, as opposed to static code analysis). The usual goal of performance analysis is to determine which sections of a program to optimize — usually either to increase its speed or decrease its memory requirement (or sometimes both). - Wikipedia
PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Webgrind Output
PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org PHP Options For Profiling DBG (http://www.php-debugger.com/dbg/)
Xdebug (http://www.xdebug.org/) Xdebug is free (as in beer and speech), actively maintained, and well-supported. I highly recommend it.
PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Installing Xdebug Put xdebug.so somewhere on your system Add something like this to php.ini: ; xdebug config Mac OS X 
 zend_extension=/Applications/MAMP/Library/share/php/xdebug.so
 xdebug.remote_enable=1
 xdebug.remote_handler=dbgp
xdebug.remote_mode=req
 xdebug.remote_host=127.0.0.1 
 xdebug.remote_port=9000
 xdebug.idekey= xdebug.profiler_enable =1 xdebug.profiler_output_dir=/Applications/MAMP/logs/xdebug ...and then restart Apache (you might have disable Zend Optimizer too)
PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Success? Your phpinfo() should look a little like this:
PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org And you'll start getting these cachegrind.out.##### files left in your  xdebug.profiler_output_dir  every time you load a PHP page...
PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org What does it mean? You don't need to know. This guy needs to know (Derick Rethans, father of Xdebug)
PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org You need a “callgrind” program Wingrind (Windows)
KcacheGrind (Linux/KDE)
MacCallGrind (Mac/OSX)
Webgrind (browser)
PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org
PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org “ Cost” When *grind refers to a function call's “cost”, it's measuring the assembly language instructions for that call. This is mostly meaningless to us in a high-level language. What's important is the relative cost. If some function call is “costing” a lot more than other calls, and it doesn't do a whole lot, that's where you need to optimize.

More Related Content

Viewers also liked (10)

PDF
Javascript fundamentals for php developers
Chris Ramakers
 
PPT
Learn javascript easy steps
prince Loffar
 
PPTX
Week 2: Getting Your Hands Dirty – Part 2
Jamshid Hashimi
 
ZIP
Fundamental JavaScript [In Control 2009]
Aaron Gustafson
 
PDF
JavaScript History
Rhio Kim
 
PDF
Introduction to JavaScript
Bryan Basham
 
PDF
Fundamental JavaScript [UTC, March 2014]
Aaron Gustafson
 
PPT
JavaScript - An Introduction
Manvendra Singh
 
PDF
JavaScript Programming
Sehwan Noh
 
PDF
Javascript Best Practices
Christian Heilmann
 
Javascript fundamentals for php developers
Chris Ramakers
 
Learn javascript easy steps
prince Loffar
 
Week 2: Getting Your Hands Dirty – Part 2
Jamshid Hashimi
 
Fundamental JavaScript [In Control 2009]
Aaron Gustafson
 
JavaScript History
Rhio Kim
 
Introduction to JavaScript
Bryan Basham
 
Fundamental JavaScript [UTC, March 2014]
Aaron Gustafson
 
JavaScript - An Introduction
Manvendra Singh
 
JavaScript Programming
Sehwan Noh
 
Javascript Best Practices
Christian Heilmann
 

Similar to Profiling PHP & Javascript (20)

KEY
LAMP Optimization
Dave Ross
 
KEY
PHP Output Buffering
Dave Ross
 
KEY
Cufon - Javascript Font Replacement
Dave Ross
 
PPT
Ruby application based on http
Richard Huang
 
PDF
Modernizing i5 Applications
ZendCon
 
PDF
Intro to JavaScript - LA - July
Thinkful
 
KEY
Intro To Django
Udi Bauman
 
PPTX
Architeching a php application with interfaces to the ib mi
Chelsea Fenton
 
ZIP
Mojolicious
Marcus Ramberg
 
ODP
Php4android TDC 2011
Kinn Julião
 
PDF
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Fabio Akita
 
PPT
PHPUnit Automated Unit Testing Framework
Dave Ross
 
PDF
Isomorphic js - React in Rails
Shifa Khan
 
PDF
Build a Game with JavaScript - Pasadena July
Thinkful
 
ODP
Introduce Django
Chui-Wen Chiu
 
PDF
Getting to know composer - (PHP)
Bill Condo
 
PDF
Using PHP Functions! (Not those functions, Google Cloud Functions)
Chris Tankersley
 
PPT
Introduction to PHP - SDPHP
Eric Johnson
 
KEY
Balsamiq Mockups
Dave Ross
 
PDF
Building a Single Page Application using Ember.js ... for fun and profit
Ben Limmer
 
LAMP Optimization
Dave Ross
 
PHP Output Buffering
Dave Ross
 
Cufon - Javascript Font Replacement
Dave Ross
 
Ruby application based on http
Richard Huang
 
Modernizing i5 Applications
ZendCon
 
Intro to JavaScript - LA - July
Thinkful
 
Intro To Django
Udi Bauman
 
Architeching a php application with interfaces to the ib mi
Chelsea Fenton
 
Mojolicious
Marcus Ramberg
 
Php4android TDC 2011
Kinn Julião
 
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Fabio Akita
 
PHPUnit Automated Unit Testing Framework
Dave Ross
 
Isomorphic js - React in Rails
Shifa Khan
 
Build a Game with JavaScript - Pasadena July
Thinkful
 
Introduce Django
Chui-Wen Chiu
 
Getting to know composer - (PHP)
Bill Condo
 
Using PHP Functions! (Not those functions, Google Cloud Functions)
Chris Tankersley
 
Introduction to PHP - SDPHP
Eric Johnson
 
Balsamiq Mockups
Dave Ross
 
Building a Single Page Application using Ember.js ... for fun and profit
Ben Limmer
 
Ad

More from Dave Ross (20)

KEY
Stylesheets of the future with Sass and Compass
Dave Ross
 
KEY
HTML5 History & Features
Dave Ross
 
PPT
A geek's guide to getting hired
Dave Ross
 
KEY
NoSQL & MongoDB
Dave Ross
 
PDF
Date and Time programming in PHP & Javascript
Dave Ross
 
KEY
Simulated Eye Tracking with Attention Wizard
Dave Ross
 
KEY
What's new in HTML5?
Dave Ross
 
KEY
The Canvas Tag
Dave Ross
 
KEY
Wordpress
Dave Ross
 
PPT
Lamp Stack Optimization
Dave Ross
 
PPT
The FPDF Library
Dave Ross
 
PPT
FirePHP
Dave Ross
 
PPT
Bayesian Inference using b8
Dave Ross
 
PPT
SQL Injection in PHP
Dave Ross
 
KEY
Web App Security: XSS and CSRF
Dave Ross
 
KEY
The Mobile Web: A developer's perspective
Dave Ross
 
KEY
Lint - PHP & Javascript Code Checking
Dave Ross
 
KEY
Firebug
Dave Ross
 
ODP
Google Maps API
Dave Ross
 
KEY
Everything You Need to Know in Order to Start Using jQuery
Dave Ross
 
Stylesheets of the future with Sass and Compass
Dave Ross
 
HTML5 History & Features
Dave Ross
 
A geek's guide to getting hired
Dave Ross
 
NoSQL & MongoDB
Dave Ross
 
Date and Time programming in PHP & Javascript
Dave Ross
 
Simulated Eye Tracking with Attention Wizard
Dave Ross
 
What's new in HTML5?
Dave Ross
 
The Canvas Tag
Dave Ross
 
Wordpress
Dave Ross
 
Lamp Stack Optimization
Dave Ross
 
The FPDF Library
Dave Ross
 
FirePHP
Dave Ross
 
Bayesian Inference using b8
Dave Ross
 
SQL Injection in PHP
Dave Ross
 
Web App Security: XSS and CSRF
Dave Ross
 
The Mobile Web: A developer's perspective
Dave Ross
 
Lint - PHP & Javascript Code Checking
Dave Ross
 
Firebug
Dave Ross
 
Google Maps API
Dave Ross
 
Everything You Need to Know in Order to Start Using jQuery
Dave Ross
 
Ad

Recently uploaded (20)

PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PDF
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
PPTX
reInforce 2025 Lightning Talk - Scott Francis.pptx
ScottFrancis51
 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
PDF
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
PPSX
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
PDF
Python Conference Singapore - 19 Jun 2025
ninefyi
 
PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
PDF
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PPTX
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
PDF
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
PDF
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
From Chatbot to Destroyer of Endpoints - Can ChatGPT Automate EDR Bypasses (1...
Priyanka Aash
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
reInforce 2025 Lightning Talk - Scott Francis.pptx
ScottFrancis51
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
Usergroup - OutSystems Architecture.ppsx
Kurt Vandevelde
 
Python Conference Singapore - 19 Jun 2025
ninefyi
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
Automating the Geo-Referencing of Historic Aerial Photography in Flanders
Safe Software
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 

Profiling PHP & Javascript

  • 1. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org PHP & Javascript Profiling Dave Ross The West Suburban Chicago PHP Meetup March 5, 2009
  • 2. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Dave Ross “ I grew up around computers, fell in love with the Internet way back in 1994, and built a successful career around my interests in computers and business. My career focus has been on e-commerce, and in my personal time I study issues related to digital identity, trust, and reputation tracking. I’m also a cat shelter volunteer, a small business owner, an avid Scrabble player, a vintage computer enthusiast, and a b-movie junkie.” Ten years professional development experience. PHP Developer, certified Java developer LinkedIn Profile: http://www.linkedin.com/in/daverossfromchicago
  • 3. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Software Profiling In software engineering, performance analysis, more commonly today known as profiling, is the investigation of a program's behavior using information gathered as the program executes (i.e. it is a form of dynamic program analysis, as opposed to static code analysis). The usual goal of performance analysis is to determine which sections of a program to optimize — usually either to increase its speed or decrease its memory requirement (or sometimes both). - Wikipedia
  • 4. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Webgrind Output
  • 5. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org PHP Options For Profiling DBG (http://www.php-debugger.com/dbg/)
  • 6. Xdebug (http://www.xdebug.org/) Xdebug is free (as in beer and speech), actively maintained, and well-supported. I highly recommend it.
  • 7. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Installing Xdebug Put xdebug.so somewhere on your system Add something like this to php.ini: ; xdebug config Mac OS X 
 zend_extension=/Applications/MAMP/Library/share/php/xdebug.so
 xdebug.remote_enable=1
 xdebug.remote_handler=dbgp
xdebug.remote_mode=req
 xdebug.remote_host=127.0.0.1 
 xdebug.remote_port=9000
 xdebug.idekey= xdebug.profiler_enable =1 xdebug.profiler_output_dir=/Applications/MAMP/logs/xdebug ...and then restart Apache (you might have disable Zend Optimizer too)
  • 8. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Success? Your phpinfo() should look a little like this:
  • 9. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org And you'll start getting these cachegrind.out.##### files left in your xdebug.profiler_output_dir every time you load a PHP page...
  • 10. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org What does it mean? You don't need to know. This guy needs to know (Derick Rethans, father of Xdebug)
  • 11. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org You need a “callgrind” program Wingrind (Windows)
  • 15. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org
  • 16. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org “ Cost” When *grind refers to a function call's “cost”, it's measuring the assembly language instructions for that call. This is mostly meaningless to us in a high-level language. What's important is the relative cost. If some function call is “costing” a lot more than other calls, and it doesn't do a whole lot, that's where you need to optimize.
  • 17. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Now, let's profile some Javascript! Download Firebug for Firefox @ http://getfirebug.com/ Why aren't you using it already?
  • 18. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org console.profile() turns on the profiler console.profileEnd() turns it off
  • 19. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Firebug Profiling
  • 20. PHP & Javascript Profiling :: Dave Ross :: The West Suburban Chicago PHP Meetup :: March 2009 :: suburbanchicagophp.org Links xdebug http://www.xdebug.org/ xdebug binaries (from Komodo) http://aspn.activestate.com/ASPN/Downloads/Komodo/RemoteDebugging Webgrind http://code.google.com/p/webgrind/ Firebug http://getfirebug.com/ “ Introducing xdebug” article http://devzone.zend.com/article/2803-Introducing-xdebug