The first case

// static routes
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/static/0';
$routes = RouteGenerator::generateToroStaticRoutes(1000);
\Toro::serve($routes);
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/static/99';
$routes = RouteGenerator::generateToroStaticRoutes(1000);
\Toro::serve($routes);
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/static/199';
$routes = RouteGenerator::generateToroStaticRoutes(1000);
\Toro::serve($routes);
// and so on up to /static/999 route
// non static routes
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/param/0/1';
$routes = RouteGenerator::generateToroStaticRoutes(1000);
\Toro::serve($routes);
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/param/99/1';
$routes = RouteGenerator::generateToroStaticRoutes(1000);
\Toro::serve($routes);
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/param/199/1';
$routes = RouteGenerator::generateToroStaticRoutes(1000);
\Toro::serve($routes);
// and so on up to /param/999/1 route

The second case

// static routes
$routes = RouteGenerator::generateToroStaticRoutes(1000);
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/static/0';
\Toro::serve($routes);
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/static/99';
\Toro::serve($routes);
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/static/199';
\Toro::serve($routes);
// and so on up to /static/999 route
// non static routes
$routes = RouteGenerator::generateToroStaticRoutes(1000);
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/param/0/1/';
\Toro::serve($routes);
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/param/99/1/';
\Toro::serve($routes);
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['REQUEST_URI'] = '/param/199/1/';
\Toro::serve($routes);
// and so on up to /param/999/1 route

OK What do we have?

The first case + static routes

+------------------------------------+---------+
| benchmark | diff |
+------------------------------------+---------+
| CoffeeSingleRequestStaticBench | 32.80x |
| DVKSingleRequestStaticBench | 15.50x |
| HoaSingleRequestStaticBench | 27.35x |
| IBSingleRequestStaticBench | 71.28x |
| MezonSingleRequestStaticBench | 5.14x |
| MiladSingleRequestStaticBench | 16.50x |
| PeceeSingleRequestStaticBench | 23.04x |
| PowerSingleRequestStaticBench | 10.98x |
| SteampixelSingleRequestStaticBench | 132.75x |
| ToroSingleRequestStaticBench | 1.00x |
+------------------------------------+---------+

The first case + non-static routes

+-----------------------------------+--------+
| benchmark | diff |
+-----------------------------------+--------+
| CoffeeSingleRequestParamBench | 4.81x |
| DVKSingleRequestParamBench | 2.37x |
| HoaSingleRequestParamBench | 4.59x |
| IBSingleRequestParamBench | 13.12x |
| MezonSingleRequestParamBench | 10.42x |
| MiladSingleRequestParamBench | 2.93x |
| PeceeSingleRequestParamBench | 6.40x |
| PowerSingleRequestParamBench | 2.84x |
| SteampixelSingleRequestParamBench | 26.93x |
| ToroSingleRequestParamBench | 1.00x |
+-----------------------------------+--------+

The second case + static routes

+----------------------------+------------+
| benchmark | diff |
+----------------------------+------------+
| CoffeeReactStaticBench | 771.02x |
| DVKReactStaticBench | 510.43x |
| HoaReactStaticBench | 161.55x |
| IBReactStaticBench | 1,166.30x |
| MezonReactStaticBench | 1.00x |
| MiladReactStaticBench | 823.27x |
| PeceeReactStaticBench | 1,065.17x |
| PowerReactStaticBench | 793.37x |
| SteampixelReactStaticBench | 10,868.16x |
| ToroReactStaticBench | 16.31x |
+----------------------------+------------+

The second case + non-static routes

+---------------------------+---------+
| benchmark | diff |
+---------------------------+---------+
| DVKReactParamBench | 11.91x |
| HoaReactParamBench | 5.34x |
| IBReactParamBench | 35.23x |
| MezonReactParamBench | 1.00x |
| MiladReactParamBench | 19.73x |
| PeceeReactParamBench | 41.28x |
| PowerReactParamBench | 14.54x |
| SteampixelReactParamBench | 212.60x |
| ToroReactParamBench | 7.54x |
+---------------------------+---------+

What’s next?

What is mezon/router?

It will be great if you will contribute something to this project. Documentation, sharing the project in your social media, bug fixing, refactoring, or even submitting issue with question or feature request. Thanks anyway )

--

--

--

php developer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Unit-testing Child Processes in node.js

Pluggable Polymer Applications

64-bit floating point: a JavaScript story

Exploring NestJS — Nest’s module system

Counting Consecutive Elements of an Array in JavaScript

Let’s Make Pong!

Alex代币IDO开奖操作文档和链接

How to write French and Spanish, German accent mark (Diacritic) in your English mac keyboard.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Dodonov Alexey

Dodonov Alexey

php developer

More from Medium

Fix Windows 10/11 Icons Not Showing Up / Working as Expected

NPM might be executing malicious code in your CI without your knowledge

How to fix SSL_ERROR_RX_RECORD_TOO_LONG in Firefox?

Tricks to code ealthy and Robust in Magento 2?