Subscribe to PHP Freaks RSS

Xdebug Update: July 2020

syndicated from on August 11, 2020

Xdebug Update: July 2020

Another monthly update where I explain what happened with Xdebug development in this past month. These will be published on the first Tuesday after the 5th of each month. Patreon and GitHub supporters will get it earlier, on the first of each month. You can become a patron to support my work on Xdebug. If you are leading a team or company, then it is also possible to support Xdebug through a subscription.

In July, I worked on Xdebug for about 100 hours, with funding being around 70 hours. I worked mostly on the following things:

Xdebug 3

I spend nearly all of my time improving performance this month, with some help by Michael Voříšek for the profiler feature. Some of this work I have done live through Twitch where I stream (almost) every Monday at 15:30 BST (14:30 UTC/10:30 EDT). Past sessions are available on Vimeo.

In order to find out what can be improved I profiled Xdebug running various workloads. I have selected the following workloads per Xdebug mode

If you have any specific one you'd like to see added, please let me know and I'll see whether I have CPU cycles for it—running composer update for Pimcore under the C profiler Valgrind takes 2½ hours per run!

In any case, the profiling found out the following possible improvements:

Switch xdebug_sprintf to a new xdebug_str_add_fmt

Xdebug often needs to convert data into a single string, for either writing to file or network, storing function names with arguments in memory, or display purposes. It uses an API xdebug_sprintf which allocates new memory and formats the string according to format specifiers. Often it needs to add this to a xdebug_str buffer that makes up a longer piece of text. After it has added it to that buffer, it frees the allocated memory again.

By creating a new API that can add a formatted string to an xdebug_str buffer, I managed to reduce the amount of memory allocations and frees dramatically. This gave a 10-15% Wall Time performance boost, and a 10-25% reduction in CPU instructions.

Truncated by Planet PHP, read more at the original (another 3405 bytes)