loading...

New PHP router wich is 30 to 50 times faster then Laravel router

alexdodonov profile image alexdodonov Updated on ・1 min read

php routes benchmarks (10 Part Series)

1) New php router is 25 times faster then klein router 2) New PHP router wich is 7 to 15 times faster then Symfony router 3 ... 8 3) New PHP router wich is 30 to 50 times faster then Laravel router 4) New PHP router wich is 24 to 42 times fatser then Yii2 router 5) Real life comparison of Symfony router and Mezon router 6) Real life comparison of Symfony router and Mezon router. Part 2 7) Benchmark of PHP Altorouter 8) New benchmark shows that Mezon PHP Router is up to 60 times faster then Slim one 9) Benchmark of Mezon PHP Router and LeagueRouter 10) Mezon PHP Router is up to 82 times fatser then Bramus Router

Intro

Hello everybody! It is time to benchmark another well known router - Laravel router (to be precise - Illuminate\Routing).

Like in the previous articles we shall test static routes and routes with parameters in them.

Static routes we shall benchmark in this way:

// repeat this in loop
with(new Illuminate\Routing\RoutingServiceProvider($app))->register();
$app['router']->get('/static', function () {
    return 'static';
});
$request = Illuminate\Http\Request::createFromGlobals();
$app['router']->dispatch($request);

And routes with parameters will be benchmarked like this:

with(new Illuminate\Routing\RoutingServiceProvider($app))->register();
$app['router']->get('/{id}', function () {
    return 'param';
});
$request = Illuminate\Http\Request::createFromGlobals();
$app['router']->dispatch($request);

Results are quite astonishing (the bigger numbers you see, the better it is)!

laravel-comparison

laravel-router

As you can see - Mezon router is 30 to 50 times faster than Laravel!!!

What is mezon/router?

mezon/router now is:

  • framework for routing with 100% code coverage
  • 10.0 points on scrutinizer-ci.com
  • router is a part of the Mezon Project

Repo on github.com: https://github.com/alexdodonov/mezon-router

I'll be very glad if you'll press "STAR" button )

php routes benchmarks (10 Part Series)

1) New php router is 25 times faster then klein router 2) New PHP router wich is 7 to 15 times faster then Symfony router 3 ... 8 3) New PHP router wich is 30 to 50 times faster then Laravel router 4) New PHP router wich is 24 to 42 times fatser then Yii2 router 5) Real life comparison of Symfony router and Mezon router 6) Real life comparison of Symfony router and Mezon router. Part 2 7) Benchmark of PHP Altorouter 8) New benchmark shows that Mezon PHP Router is up to 60 times faster then Slim one 9) Benchmark of Mezon PHP Router and LeagueRouter 10) Mezon PHP Router is up to 82 times fatser then Bramus Router

Discussion

markdown guide
 
 

I am sure it can, but I don't know how ))
I shall add in my content plan to write an article about it.

 

This is nice, but how many apps will really need that speed? In my experience, good portion of apps will never ever go beyond 600 req/sec

 

It is usefull to have opportunity to execute 20K req/sec.

By the way 600 req/sec is not too much nowdays.

And thanks for your comment )