-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbalance.php
More file actions
32 lines (26 loc) · 779 Bytes
/
balance.php
File metadata and controls
32 lines (26 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/**
*
* @author jan huang <bboyjanhuang@gmail.com>
* @copyright 2016
*
* @link https://www.github.com/janhuang
* @link http://www.fast-d.cn/
*/
include __DIR__ . '/vendor/autoload.php';
$request = new \FastD\Http\ServerRequest('GET', '/g/30000');
for ($n = 0; $n < 100; $n++) {
$nRoutes = 1000;
$nMatches = 300;
$router = new \FastD\Routing\RouteCollection();
$startTime = microtime(true);
for ($i = 0, $str = 'a'; $i < $nRoutes; $i++, $str++) {
$router->addRoute('GET', '/' . $str . '/{arg}', function () {
return 'hello world';
});
}
for ($i = 0; $i < $nMatches; $i++) {
$res = $router->match($request);
}
printf("FastD first route: %f\n", microtime(true) - $startTime);
}