PHP Classes

File: tests/altorouter/single-request-100.php

Recommend this page to a friend!
  Classes of Alexey Dodonov   Mezon Router Benchmark   tests/altorouter/single-request-100.php   Download  
File: tests/altorouter/single-request-100.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: 1 year ago
Size: 935 bytes
 

Contents

Class file image Download
<?php

$benchmark
->registerTest(function () {
   
$startTime = microtime(true);
    for (
$i = 0; $i < \Mezon\Benchmark\Base::$iterationsAmount; $i ++) {
       
$router = \Mezon\Benchmark\RouteGenerator::generateAltorouterStaticRoutes(100);

       
$router->match('/static/' . rand(0, 100 - 1))['target']();
    }
    return
microtime(true) - $startTime;
},
"[altorouter/single-request/100 routes] Resolving static routes %f per second\r\n");
   
   
$benchmark->registerTest(function () {
       
$startTime = microtime(true);
        for (
$i = 0; $i < \Mezon\Benchmark\Base::$iterationsAmount; $i ++) {
           
$router = \Mezon\Benchmark\RouteGenerator::generateAltorouterNonStaticRoutes(100);

           
$router->match('/param/' . rand(0, 100 - 1) . '/1')['target']();
        }
        return
microtime(true) - $startTime;
    },
"[altorouter/single-request/100 routes] Resolving param. routes %f per second\r\n");