Skip to content

Instantly share code, notes, and snippets.

@LasseRafn
Last active February 27, 2017 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LasseRafn/89114bc3a349e0b287e2485b1f174c97 to your computer and use it in GitHub Desktop.
Save LasseRafn/89114bc3a349e0b287e2485b1f174c97 to your computer and use it in GitHub Desktop.

Setup

I simply created two apps using latest version of each framework, using: laravel new laravel lumen new lumen`

I added a route to each (on /) both simply returning 'ok'. Of cause, I added the route to Laravels API routes.

Command used to test

for i in {1..100};do curl -s -w "%{time_total}\n" -o /dev/null http://laravel.dev/api;  done
for i in {1..100};do curl -s -w "%{time_total}\n" -o /dev/null http://lumen.dev;  done

Results (response times) Lower is better.

Laravel

0.065 0.059 0.056 0.051 0.052 0.058 0.051 0.059 0.050 0.059 0.050 0.057 0.052 0.050 0.052 0.052 0.056 0.050 0.057 0.049 0.051 0.053 0.051 0.054 0.050 0.050 0.051 0.058 0.051 0.050 0.050 0.054 0.050 0.052 0.049 0.052 0.055 0.051 0.050 0.052 0.051 0.050 0.057 0.051 0.050 0.051 0.050 0.055 0.051 0.050 0.050 0.052 0.054 0.052 0.053 0.052 0.070 0.064 0.059 0.051 0.051 0.048 0.051 0.052 0.049 0.056 0.059 0.057 0.054 0.049 0.064 0.066 0.069 0.071 0.073 0.066 0.065 0.076 0.058 0.072 0.089 0.076 0.079 0.088 0.078 0.086 0.072 0.103 0.066 0.078 0.082 0.103 0.084 0.074 0.053 0.069 0.083 0.073 0.083 0.099

Lumen

0.023 0.034 0.021 0.022 0.022 0.022 0.022 0.021 0.024 0.019 0.021 0.020 0.021 0.021 0.023 0.019 0.024 0.019 0.024 0.019 0.021 0.019 0.022 0.020 0.022 0.020 0.021 0.019 0.024 0.019 0.022 0.019 0.022 0.019 0.022 0.021 0.023 0.019 0.024 0.019 0.024 0.020 0.022 0.020 0.022 0.019 0.022 0.020 0.026 0.021 0.021 0.021 0.024 0.019 0.024 0.019 0.023 0.019 0.021 0.019 0.021 0.022 0.023 0.022 0.023 0.020 0.022 0.022 0.023 0.020 0.019 0.032 0.024 0.019 0.021 0.020 0.021 0.019 0.021 0.022 0.024 0.019 0.024 0.020 0.024 0.020 0.024 0.019 0.024 0.019 0.023 0.020 0.021 0.019 0.020 0.021 0.024 0.019 0.025 0.019

Conclusion

On a default setup, Lumen is almost 3x faster.

Other attempts

To speed up Laravel (and not Lumen) I tried some things

  • php artisan route:cache
  • php artisan config:cache
  • php artisan optimize
  • Removed throttling
  • Removed Tinker Service Provider from config/app.php And the average request time went from 60ms to 47ms, where Lumen was at 22ms.

Disclaimer

Caching, settings and more could probably even these out a bit, I don't know.. However Lumen is supposed to be faster.. Also, an average of ~60ms request response time (locally, returning 'ok') seems fair though.. considering the power Laravel brings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment