View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001658 | Xdebug | Uncategorized | public | 2019-04-21 14:48 | 2019-07-19 11:39 |
Reporter | clewis2019 | Assigned To | derick | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Product Version | 2.7.0 | ||||
Summary | 0001658: Very slow performance when xdebug extension is loaded, but not enabled | ||||
Description | Running simple php benchmark script, http://www.php-benchmark-script.com, which just loops over a series of string and math operations with php 7.0, 7.1, or 7.3, results in execution time being 6-7 times slower than without the extension loaded. This is on a centos 7 system. strace -c shows: % time seconds usecs/call calls errors syscall 90.93 0.239892 10 25066 gettimeofday without xdebug loaded: % time seconds usecs/call calls errors syscall 34.58 0.010055 15 677 20 stat /etc/php.d/xdebug.ini: ;zend_extension=/usr/lib64/php/modules/xdebug.so | ||||
Steps To Reproduce | run attached script with or without xdebug extension enabled: | ||||
Additional Information | I was expecting that with xdebug loaded, but not triggered, the performance would be roughly the same as with it not loaded, but that is not what I have experienced. | ||||
Tags | performance | ||||
Attached Files | bench.php (3,175 bytes)
<pre> <?php /* ########################################################################## # PHP Benchmark Performance Script # # � 2010 Code24 BV # # # # Author : Alessandro Torrisi # # Company : Code24 BV, The Netherlands # # Date : July 31, 2010 # # version : 1.0 # # License : Creative Commons CC-BY license # # Website : http://www.php-benchmark-script.com # # # ########################################################################## */ function test_Math($count = 1000) { $time_start = microtime(true); $mathFunctions = array("abs", "acos", "asin", "atan", "bindec", "floor", "exp", "sin", "tan", "pi", "is_finite", "is_nan", "sqrt"); foreach ($mathFunctions as $key => $function) { if (!function_exists($function)) unset($mathFunctions[$key]); } for ($i=0; $i < $count; $i++) { foreach ($mathFunctions as $function) { $r = call_user_func_array($function, array($i)); } } return number_format(microtime(true) - $time_start, 3); } function test_StringManipulation($count = 1000) { $time_start = microtime(true); $stringFunctions = array("addslashes", "chunk_split", "metaphone", "strip_tags", "md5", "sha1", "strtoupper", "strtolower", "strrev", "strlen", "soundex", "ord"); foreach ($stringFunctions as $key => $function) { if (!function_exists($function)) unset($stringFunctions[$key]); } $string = "the quick brown fox jumps over the lazy dog"; for ($i=0; $i < $count; $i++) { foreach ($stringFunctions as $function) { $r = call_user_func_array($function, array($string)); } } return number_format(microtime(true) - $time_start, 3); } function test_Loops($count = 1000) { $time_start = microtime(true); for($i = 0; $i < $count; ++$i); $i = 0; while($i < $count) ++$i; return number_format(microtime(true) - $time_start, 3); } function test_IfElse($count = 1000) { $time_start = microtime(true); for ($i=0; $i < $count; $i++) { if ($i == -1) { } elseif ($i == -2) { } else if ($i == -3) { } } return number_format(microtime(true) - $time_start, 3); } $total = 0; $functions = get_defined_functions(); $line = str_pad("-",38,"-"); echo "<pre>$line\n|".str_pad("PHP BENCHMARK SCRIPT",36," ",STR_PAD_BOTH)."|\n$line\nStart : ".date("Y-m-d H:i:s")."\nServer : {$_SERVER['SERVER_NAME']}@{$_SERVER['SERVER_ADDR']}\nPHP version : ".PHP_VERSION."\nPlatform : ".PHP_OS. "\n$line\n"; foreach ($functions['user'] as $user) { if (preg_match('/^test_/', $user)) { $total += $result = $user(); echo str_pad($user, 25) . " : " . $result ." sec.\n"; } } echo str_pad("-", 38, "-") . "\n" . str_pad("Total time:", 25) . " : " . $total ." sec.</pre>"; echo "\n"; ?> | ||||
Operating System | lin | ||||
PHP Version | 7.0.20-7.0.24 | ||||
|
The gettimeofday issue (top of your list), should be fixed in Xdebug 2.7.1: https://bugs.xdebug.org/view.php?id=1641 — Will you please try that? Besides that, Xdebug does have quite a bit of overhead, even it's enabled. I hope to fix that in Xdebug 3.0, as outline at https://derickrethans.nl/xdebug-experience.html |
|
I followed your suggestion and compiled the 2.7.1 version, but did not see any improvement: the overall performance was still about 6 times slower. The number of gettimeofday did not change. % time seconds usecs/call calls errors syscall 90.81 0.248393 10 25066 gettimeofday |
|
I am also running into this issue. I was using PHP 7.0 with xdebug 2.5.0 with no slowness when the extension was loaded and not enabled, but now, using PHP 7.3 with xdebug 2.7.1 and 2.7.2 (the 2 versions I tried) my application becomes extremely slow. I originally reported this issue here https://bugs.xdebug.org/view.php?id=1685 thinking I was running into another problem. |
|
I am closing out this issue, as there is no actionable issue here. I am reviewing Xdebug's performance for Xdebug 3.0. |
Date Modified | Username | Field | Change |
---|---|---|---|
2019-04-21 14:48 | clewis2019 | New Issue | |
2019-04-21 14:48 | clewis2019 | Tag Attached: performance | |
2019-04-21 14:48 | clewis2019 | File Added: bench.php | |
2019-04-21 15:03 | derick | Assigned To | => derick |
2019-04-21 15:03 | derick | Status | new => feedback |
2019-04-21 15:03 | derick | Note Added: 0005003 | |
2019-04-21 21:16 | clewis2019 | Note Added: 0005005 | |
2019-04-21 21:16 | clewis2019 | Status | feedback => assigned |
2019-07-18 00:07 | huguesalary | Note Added: 0005068 | |
2019-07-19 11:39 | derick | Status | assigned => resolved |
2019-07-19 11:39 | derick | Resolution | open => no change required |
2019-07-19 11:39 | derick | Note Added: 0005073 | |
2020-03-12 16:35 | derick | Category | Usage problems (Wrong Results) => Variable Display |
2020-03-12 16:38 | derick | Category | Variable Display => Uncategorized |