PHP Classes

File: tests/pux/react-1000.php

Recommend this page to a friend!
  Classes of Alexey Dodonov   Mezon Router Benchmark   tests/pux/react-1000.php   Download  
File: tests/pux/react-1000.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Mezon Router Benchmark
Measure the performance of PHP framework routers
Author: By
Last change:
Date: 2 years ago
Size: 896 bytes
 

Contents

Class file image Download
<?php
$benchmark
->registerTest(function () {
   
$router = \Mezon\Benchmark\RouteGenerator::generatePuxStaticRoutes(1000);

   
$startTime = microtime(true);
    for (
$i = 0; $i < \Mezon\Benchmark\Base::$iterationsAmount; $i ++) {
       
$result = $router->dispatch('/static/' . rand(0, 1000 - 1));
       
$result[2]();
    }
    return
microtime(true) - $startTime;
},
"[pux/react/1000 routes] Resolving static routes %f per second\r\n");

$benchmark->registerTest(function () {
   
$router = \Mezon\Benchmark\RouteGenerator::generatePuxNonStaticRoutes(1000);

   
$startTime = microtime(true);
    for (
$i = 0; $i < \Mezon\Benchmark\Base::$iterationsAmount; $i ++) {
       
$result = $router->dispatch('/param/' . rand(0, 1000 - 1) . '/1');
       
$result[2]();
    }
    return
microtime(true) - $startTime;
},
"[pux/react/1000 routes] Resolving param. routes %f per second\r\n");