rector/vendor/evenement/evenement/examples/benchmark-emit-no-arguments.php
Tomas Votruba aae549741f Updated Rector to commit 0cb3fd0feb464b4568e07607a05c794637aa2862
0cb3fd0feb [Php73] Handle crash Type Error on JsonThrowOnErrorRector (#4626)
2023-08-01 10:55:14 +00:00

26 lines
747 B
PHP

<?php
declare (strict_types=1);
namespace RectorPrefix202308;
/*
* This file is part of Evenement.
*
* (c) Igor Wiedler <igor@wiedler.ch>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
const ITERATIONS = 10000000;
use RectorPrefix202308\Evenement\EventEmitter;
require __DIR__ . '/../vendor/autoload.php';
$emitter = new EventEmitter();
$emitter->on('event', function () {
});
$start = \microtime(\true);
for ($i = 0; $i < \RectorPrefix202308\ITERATIONS; $i++) {
$emitter->emit('event');
}
$time = \microtime(\true) - $start;
echo 'Emitting ', \number_format(\RectorPrefix202308\ITERATIONS), ' events took: ', \number_format($time, 2), 's', \PHP_EOL;