Skip to content

Does major performance impact? #65

@iNiSiRe

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions