Xdebug 2.3: Profiler File Compression
This is the seventh (and last) article in a series about new features in Xdebug 2.3, which was first released on February 22nd.
When you make profiling dumps with Xdebug, the file size can grow quite large. Even with a simple Drupal page a profile file is easily close to 1Mb.
For each function call, the file contains the location and name of the calling function, and then a list of functions that have been called. For example, the following snippet shows that the _cache_get_object function in /home/httpd/drupal-test/drupal-7.15/includes/cache.inc calls variable_get in /home/httpd/drupal-test/drupal-7.15/includes/bootstrap.inc twice, and DrupalDatabaseCache->__construct once:
fl=/home/httpd/drupal-test/drupal-7.15/includes/cache.inc fn=_cache_get_object 22 68 cfl=/home/httpd/drupal-test/drupal-7.15/includes/bootstrap.inc cfn=variable_get calls=1 0 0 27 4 cfl=/home/httpd/drupal-test/drupal-7.15/includes/bootstrap.inc cfn=variable_get calls=1 0 0 29 2 cfl=/home/httpd/drupal-test/drupal-7.15/includes/cache.inc cfn=DrupalDatabaseCache->__construct calls=1 0 0 31 5
In those 15 lines, you can already spot a lot of duplicated information. The Callgrind Profile Format which Xdebug uses for writing profiling information allows for Name Compression. This allows a write, such as Xdebug, to simple refer to longer strings by a number. This number is assigned the first time a certain file name or function name is encountered. The above snippet, from the same request of a Drupal site, with Name Compression enabled now looks like:
fl=(4) fn=(53) _cache_get_object 22 80 cfl=(2) cfn=(45) calls=1 0 0 27 4 cfl=(2) cfn=(45) calls=1 0 0 29 3 cfl=(4) cfn=(52) calls=1 0 0 31 5
Every file name and function name, except for _cache_get_object has been previously defined, and hence, is not repeated in its entirety, but just by its identifier. This sort of compression makes the profiling files a lot smaller. In this case, my simple-Drupal-profiling file went down from 926Kb to 385Kb.
Other parts in this series:
Life Line
The Secret Maps exhibition at the British Library is well worth a visit!
We went last Sunday and it still runs to January.
📷 Mirror
🚩 The Terrace, London Borough of Richmond upon Thames, United Kingdom
📷 Green, Red, Orange, and Yellow
🚩 Mortlake High Street, London Borough of Richmond upon Thames, United Kingdom
📷 Leaf
🚩 Lonsdale Road, London Borough of Richmond upon Thames, United Kingdom
I walked 10.6km in 1h47m32s
Merged pull request #1048
Fixed issue #2386: Crashes when running context_get in an exception t…
It's PHP 8.5 release week !
I'm giving two talks on what's new in it, first on Wednesday evening in Leeds: https://www.meetup.com/leedsphp/events/311677834/
And then on Thursday evening in Rotterdam: https://eventy.io/events/q8lmw0v4Will I see you there?
@robinince Loving the new series of the Infinite Monkey Cage so far! #bbc
I walked 1.7km in 18m51s
Updated a clothes shop and a restaurant; Deleted a dentist; Confirmed an estate_agent shop, a dentist, and 2 other objects
I walked 3.4km in 39m19s
I walked 5.7km in 57m30s
📷 Low Thames
🚩 Ranelagh Gardens, London Borough of Hammersmith and Fulham, United Kingdom
I walked 3.3km in 31m40s
Updated a cafe
I walked 6.8km in 1h14m22s
Created 2 gates; Updated a gate
I hiked 16.4km in 3h1m52s







Shortlink
This article has a short URL available: https://drck.me/profilecomp23-bp6