Kane Cohen

View My GitHub Profile
Follow Me

WRITTEN ON JAN 30, 2015Home

Benchmarks: Laravel 5 vs Laravel 4 vs Symfony 2.6

You know those "Hello World" benchmarks that are so often could be found on the web comparing speed of execution of various programming languages, frameworks written on same or different languages? This one won't be too different.

I've been using Lravel PHP framework for over two years now and very happy with the way it works and how fast it allows me to produce working application. But its power - large collection of tools for all purposes, has effect on its speed. Laravel is not the slowest framework on the market, but it's not the fastest. Which is completely acceptable for me. Plus, I think that in the end, large applications built on top of the smaller and faster frameworks would slow down after you start adding all the required tools that application would need.

This post does not have any point to prove, nor is it a statement of anything - just a simple curiosity to benchmark Laravel 4 and Laravel 5. Plus Symfony 2.6 for the perspective.





Each test uses Autobench and httperf via it to gather statistics. Here's an example of the command:

autobench --server eample.com --uri / --low_rate 20 -high_rate 100 \
--rate_step 20 --num_conn 2000 --num_call 1 --timeout 5

This command will do 5 consecutive tests on the same domain each time increasing request rate by 20. Starting request rate is 20 and maximum is set at 100.

Requests were being made from the remote Amazon EC2 instance (~67ms ping to tested server - keep that in mind when checking response time results).

Laravel 4 and Laravel 5 were using precompiled common classes to speed them up.


Above each chart you can find description for each run and buttons to check different stats.

Hello World run

Following chart shows stats for bare-bones run with 1 route in both apps, one blade layout view with one variable passed in and printed within the view. Symfony uses basic AcmeDemo code and benchmarks were done against `/demo` route - very simple printing of several links.

  • Laravel 4
  • Laravel 5
  • Symfony 2.6

300 routes run

Here I've added over 300 routes to each application, but requests are made to the same route.

  • Laravel 4
  • Laravel 5

300 cached routes run

Same 300+ routes run, but in Laravel 5 I've used `php artisan route:cache` to cache routes in a filesystem.

  • Laravel 4
  • Laravel 5

300 cached routes run + Validation

Another similar run, but now a little bit more complexity on the requested route. L4 controller method loads Validation Factory via DI in constructor and then runs a simple validation against several rules. L5 has the same rules, but validation is done in FormRequest that is injected into the routed method.

  • Laravel 4
  • Laravel 5


As I said - I'm not trying to prove anything whatsoever. I was curious as to how does new version of my favourite framework fares against older version and for perspective against Symfony since Laravel has roots in Symfony.

Got any questions or want some extra details about benchmarks? Find me on twitter.