Subversion Repositories php-qbpwcf

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 liveuser 1
<?php declare(strict_types=1);
2
 
3
/*
4
 * This file is part of Evenement.
5
 *
6
 * (c) Igor Wiedler <igor@wiedler.ch>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
 
12
ini_set('memory_limit', '512M');
13
 
14
const ITERATIONS = 100000;
15
 
16
use Evenement\EventEmitter;
17
 
18
require __DIR__.'/../vendor/autoload.php';
19
 
20
$emitter = new EventEmitter();
21
 
22
for ($i = 0; $i < ITERATIONS; $i++) {
23
    $emitter->once('event', function ($a, $b, $c) {});
24
}
25
 
26
$start = microtime(true);
27
$emitter->emit('event', [1, 2, 3]);
28
$time = microtime(true) - $start;
29
 
30
echo 'Emitting one event to ', number_format(ITERATIONS), ' once listeners took: ', number_format($time, 2), 's', PHP_EOL;