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.
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
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
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
On a default setup, Lumen is almost 3x faster.
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.
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.