Make Correct Comparisons

Taylor Otwell
2 min readDec 12, 2017

--

This morning Fabien Potencier released a blog post claiming Symfony Flex is three times faster than Laravel 5.5. Of course, as usual, I had my typical doubts that they are comparing their best case scenario against the default Laravel installation which includes cookie encryption, extra service providers, sessions, and more enabled out of the box.

Laravel includes these things out of the box because I want the default framework experience to be ready to build a robust, modern web application. That includes background jobs, real-time event broadcasting, authentication, and more.

So, to test my suspicions, I created a fresh Symfony Flex application and a fresh Laravel 5.5 application. I then spent roughly five minutes disabling the default HTTP kernel middleware and other “optional” parts of the Laravel installation in order to make it a more fair comparison. After making those tweaks and running Apache Benchmark on the two applications, I did find Symfony Flex was slightly faster out of the box; however, a far cry from the “three times faster” claim:

Symfony 4: 224 requests per second.

Laravel 5.5: 202 requests per second.

I’ll be running more tests today on a server with Opcache properly configured and will update with my results.

Update: I have run comparisons on a more production configured server with Opcache configured. Symfony 4 was about 3ms faster, with Laravel 5.5 running in about 18.5ms and Symfony 4 running in about 15.1ms. Again, I am not able to replicate anything close to a 3x speed advantage:

In conclusion, it’s important to make apples to apples comparisons when comparing framework speed. Is one framework disabling common features while another has them enabled? Adjust them to get them on even ground. Furthermore, understand that it’s often useless to even make such comparisons, as even a single database call or HTTP call will immediately make such differences trivial.

--

--