PHP Classes

File: vendor/evenement/evenement/examples/benchmark-emit-one-argument.php

Recommend this page to a friend!
  Classes of Adeleye Ayodeji   Simple PHP Chat with Websocket   vendor/evenement/evenement/examples/benchmark-emit-one-argument.php   Download  
File: vendor/evenement/evenement/examples/benchmark-emit-one-argument.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Simple PHP Chat with Websocket
Implements a chat system using Websockets
Author: By
Last change:
Date: 5 months ago
Size: 660 bytes
 

Contents

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

/*
 * 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
Evenement\EventEmitter;

require
__DIR__.'/../vendor/autoload.php';

$emitter = new EventEmitter();

$emitter->on('event', function ($a) {});

$start = microtime(true);
for (
$i = 0; $i < ITERATIONS; $i++) {
   
$emitter->emit('event', [1]);
}
$time = microtime(true) - $start;

echo
'Emitting ', number_format(ITERATIONS), ' events took: ', number_format($time, 2), 's', PHP_EOL;