Add route caching
Use route cache automatically the same way as the config cached.
It saves ~3ms on every request for me.
Running 'php artisan route:cache' adds about 300ms to the cold start (tested on x64 / 1024M)
Status update: want to test this myself in a real project too, +300ms to the cold start is not negligible, even to get -3ms on warm invokes.
The alternative for people interested in optimizing performance is to cache routes before deploying (https://mnapoli.fr/optimizing-laravel-aws-lambda), which maybe makes more sense here.
Shouldn't the route caching happen as part of the build process?
Yes exactly my point
Well, if you know that you should (and can) run route:cache before deploying, it has no effect for you. Otherwise, it’s done automatically, with the benefit of faster responses.
I agree that it should be part of the build process, I do it now too :)