Skip to content

Commit

Permalink
Optimize package registration (#30960)
Browse files Browse the repository at this point in the history
As per the discussion in #30952 and according to my tests, `strpos` is considerably faster than calling startsWith for short haystacks.
  • Loading branch information
36864 authored and taylorotwell committed Dec 28, 2019
1 parent ba15a1a commit befe49c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Expand Up @@ -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()]);
Expand Down

0 comments on commit befe49c

Please sign in to comment.