PHP Classes

File: vendor/evenement/evenement/examples/benchmark-emit-once.php

Recommend this page to a friend!
  Classes of butani kartik  >  PHP WebSockets Server Example  >  vendor/evenement/evenement/examples/benchmark-emit-once.php  >  Download  
File: vendor/evenement/evenement/examples/benchmark-emit-once.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP WebSockets Server Example
Example to interact with a server using WebSockets
Author: By
Last change:
Date: 2 months ago
Size: 729 bytes


Class file image Download
<?php declare(strict_types=1);

 * This file is part of Evenement.
 * (c) Igor Wiedler <>
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.

ini_set('memory_limit', '512M');

ITERATIONS = 100000;



$emitter = new EventEmitter();

for (
$i = 0; $i < ITERATIONS; $i++) {
$emitter->once('event', function ($a, $b, $c) {});

$start = microtime(true);
$emitter->emit('event', [1, 2, 3]);
$time = microtime(true) - $start;

'Emitting one event to ', number_format(ITERATIONS), ' once listeners took: ', number_format($time, 2), 's', PHP_EOL;

For more information send a message to info at phpclasses dot org.