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

Introduction to Regular Expressions

Inverno Reactive Template for efficient data rendering

Inheritance in Javascript is a myth

Working with AWS SQS FIFO Queues

How to setup Electron with React and package it for distribution

How to build modern SPA’s on Salesforce

How to Locomotive Scroll and Nuxt (with example and gotchas)

How do they make browser games nowadays? Part 3

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

GSoC 2015 — Moorsp plugin for Moodle — Wrap Up

The experience that changed my life (part 2)

Top 15 Achievements of CodeRiders Software Company in 2021

CodeRiders is a recognized software company among the international IT industry

Configure direct upload to S3 from the Linux file manager in less than 10 minutes!