Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does major performance impact? #65

Open
iNiSiRe opened this issue Apr 15, 2022 · 1 comment
Open

Does major performance impact? #65

iNiSiRe opened this issue Apr 15, 2022 · 1 comment

Comments

@iNiSiRe
Copy link

iNiSiRe commented Apr 15, 2022

<?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.

@longxinH
Copy link
Owner

Yes, added a hook to zend, so it will affect performance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants