Practical Performance Profiling

Andrey “Rarst” Savchenko, WordCamp Norway 2015

Practical Performance Profiling

Andrey “Rarst” Savchenko

Map

200ms

interface interactivity boundary

goal 1

10ms resolution

Internet is lying to you

  1. Enable profiler extension…
  2. Load the page to profile…
  3. Find the resulting profile file…
  4. Launch the profile viewer application…
  5. Load the profile file in viewer application…

Bullshit.

goal 2

0..2 clicks

Low setup, low detail

var_dump() of profiling

printf(
	'%d queries in %.3f seconds, using %.2fMB memory',
	get_num_queries(),
	timer_stop( 0, 3 ),
	memory_get_peak_usage() / 1024 / 1024
);
// 3 queries in 0.251 seconds, using 4.42MB memory

Symfony Stopwatch

$stopwatch = new Stopwatch();
$stopwatch->start( 'eventName' );
// some code goes here
$event = $stopwatch->stop( 'eventName' );
echo $event->getDuration(); // 202
echo $event->getmemory(); // 3670016
symfony.com/doc/current/components/stopwatch
Laps interface

Laps

github.com/Rarst/laps

High setup, high detail

XHProf / uprofiler

github.com/FriendsOfPHP/uprofiler

Blackfire

blackfire.io Blackfire logo
uProfiler in action

Practical performance profiling

Complete in–browser workflow.

Hands off, always on

New Relic

newrelic.com New Relic logo

WP Performance Profiler

wpperformanceprofiler.interconnectit.com

next monday

install Laps

a while later

question results

Thank you for listening! Questions?

@Rarst
Rarst.net/slides/profiling
Rarst.net/slides/profiling/code