You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 2, 2018. It is now read-only.
Hi there. First of all thanks for the benchmark. I was impressed by good performance of FastRoute and decided to look at worst-case-tests.php
I have played with it a bit and thought that it will be good idea to measure the time it takes by FastRoute to find a given route directly inside "setupFastRoute" function.
Hi there. First of all thanks for the benchmark. I was impressed by good performance of FastRoute and decided to look at worst-case-tests.php
I have played with it a bit and thought that it will be good idea to measure the time it takes by FastRoute to find a given route directly inside "setupFastRoute" function.
-----This is changes that I've made -----
function setupFastRoute(Benchmark $benchmark, $routes, $args)
{
$argString = implode('/', array_map(function ($i) { return "{arg$i}"; }, range(1, $args)));
$str = $firstStr = $lastStr = '';
$router = \FastRoute\simpleDispatcher(function ($router) use ($routes, $argString, &$lastStr) {
for ($i = 0; $i < $routes; $i++) {
list ($pre, $post) = getRandomParts();
$str = '/' . $pre . '/' . $argString . '/' . $post;
if (0 === $i) {
$firstStr = str_replace(array('{', '}'), '', $str);
}
$lastStr = str_replace(array('{', '}'), '', $str);
$router->addRoute('GET', $str, 'handler' . $i);
}
});
$start = microtime(true);
$route = $router->dispatch('GET', $lastStr);
echo microtime(true) - $start ;
}
and I am getting a surprisingly slow result of 0.0069520473480225
Do you think that something is wrong with FastRoute's benchmark?
The text was updated successfully, but these errors were encountered: