Skip to content

[7.x] Optimize container#32194

Merged
taylorotwell merged 2 commits intolaravel:7.xfrom
nguyenyou:optimize-container
Apr 2, 2020
Merged

[7.x] Optimize container#32194
taylorotwell merged 2 commits intolaravel:7.xfrom
nguyenyou:optimize-container

Conversation

@nguyenyou
Copy link
Copy Markdown
Contributor

What I saw is the getContextualConcrete method is called twice during the execution of the resolve method, in case the given $parameters is empty.

We're able to make it to be called once by capturing its return value, and then before calling the getConcrete method, we will check if that value is null. If the value is not null, just use it.

The behavior is exactly the same, the benefit is reducing an unnecessary method call.

@taylorotwell taylorotwell merged commit ed9228d into laravel:7.x Apr 2, 2020
@nguyenyou nguyenyou deleted the optimize-container branch April 3, 2020 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants