From befe49cc958b683a89f97819be8b7ec6fc29f2df Mon Sep 17 00:00:00 2001 From: 36864 <36864@users.noreply.github.com> Date: Sat, 28 Dec 2019 13:02:02 +0000 Subject: [PATCH] Optimize package registration (#30960) As per the discussion in #30952 and according to my tests, `strpos` is considerably faster than calling startsWith for short haystacks. --- src/Illuminate/Foundation/Application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Illuminate/Foundation/Application.php b/src/Illuminate/Foundation/Application.php index 752940fa3250..b316dc3ca62f 100755 --- a/src/Illuminate/Foundation/Application.php +++ b/src/Illuminate/Foundation/Application.php @@ -584,7 +584,7 @@ public function registerConfiguredProviders() { $providers = Collection::make($this->config['app.providers']) ->partition(function ($provider) { - return Str::startsWith($provider, 'Illuminate\\'); + return strpos($provider, 'Illuminate\\') === 0; }); $providers->splice(1, 0, [$this->make(PackageManifest::class)->providers()]);