A Week of Blackfire 2

By Fabien Potencier, on Dec 30, 2014

2015 is just around the corner! I hope many of you are able to take some days off from work to celebrate New Year’s Eve. You will probably come back to work with many good resolutions and I have an additional one for you: profiling your applications to better understand how your code behaves and try to optimize it.

And last week, the Blackfire team worked on the profiling experience based on the feedback from early adopters; nothing big, but many small and useful changes.

A Resizable Sidebar

Many modern Open-Source PHP libraries use namespaces to better organize their classes and to avoid conflicts with other libraries; that makes for very long class names. On a profile page, Blackfire displays the call graph and a sidebar with all function calls. When designing this screen, we decided to give the call graph more space as it is easier to navigate a visual representation of the code execution. But sometimes, having a look at the table is very useful and being able to see to whole class names helps. As of today, you can now resize the sidebar to get the best of both worlds:

Better Warnings and Errors

When things go bad, we’d better help you the best we can. And during the last week, we improved warnings and errors a lot.

When profiling a page, Blackfire detects things that might affect the accuracy of the performance data we gather like an outdated Blackfire probe or agent, a high load on the machine, or an incompatible PHP extension. Those warnings are now prominently displayed on the profile page:

warnings

Another big improvement is the feedback you get when something goes wrong during the processing of your data. Because of the way our worker worked, it was impossible to tell you if the profile was processing or if it ended with an error, we just displayed the “Processing your Profile” message with a spinner. As of today, you get a nice error message that tells you why we weren’t able to process your profile; that sounds like the basics, but unfortunately we did not do a good job until now.

Metrics Comparison

Metrics are a great way to detect common problems that affect the performance of your code (like the number of included classes for a request or the number of ESIs included in a page.) It’s also very interesting to see the evolution of those metrics when comparing two profiles; that’s exactly what we’ve added today:

metrics-comparison

As you can see, it’s very easy to spot what improved and what became worse.

Automatic Aggregation when profiling a CLI Script

The Web Companion automatically aggregates several profiles when you want to check the performance of a web page to get more accurate results.

As of today, you can also do the same from the command line when profiling HTTP requests:

Or any script:

By default, Blackfire takes only 1 sample as it cannot determine if the command you want to run or the HTTP request you want to profile is “safe”. Learn more about profiling scripts, Web Services calls, or regular HTTP requests from the CLI.

Upgrade Blackfire to get access to this new feature.

Small Things that matter

I won’t list all the tweaks and fixes that we made during the last week, but some of them are worth mentioning:

  • The exclusive cost of a function is not displayed as a callee anymore;
  • The Blackfire settings displayed by phpinfo() now takes environment variables into account;
  • The Companion is now able to correctly profile pages that use HTTP validation;
  • Mac users reported that brew doctor warns about a problem with Blackfire; it was a false positive but we fixed it anyway. To get rid of all homebrew warnings, follow these steps (no need to uninstall or reinstall Blackfire):

Happy new year and happy profiling!

Fabien Potencier

Fabien Potencier is the CEO and founder of Blackfire.io. He founded the Symfony project in 2004 as he constantly looked for better ways to build websites. Fabien is also the creator of several other Open-Source projects, a writer, a blogger, a speaker at international conferences, and the happy father of two wonderful kids.