<?php
$enableProfiling = $_ENV['ENABLE_PROFILING'] ?? false;
if ($enableProfiling) {
xhprof_enable();
}
$start = microtime(true);
$test = 'abcd';
for ($i = 0; $i < 1_000_000; $i++) {
$test = md5($test);
}
echo sprintf('Elapsed: %f', microtime(true) - $start) . PHP_EOL;
if ($enableProfiling) {
xhprof_disable();
}
ENABLE_PROFILING=1 php ./bin/test.php
Elapsed: 9.300184
ENABLE_PROFILING=0 php ./bin/test.php
Elapsed: 0.386227
I did something wrong or it's normal behaviour?
PHP 8.0/7.3, xhprof 2.3.5.
I did something wrong or it's normal behaviour?
PHP 8.0/7.3, xhprof 2.3.5.