[9.x] Allow disabling checks for expired views #44674
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One of the changes @nunomaduro made in #44487 reminded me of a similar PR (#31206) I'd done about 2 years ago that was merged and then reverted due to a reported edge case bug.
The reported bug was that the
view:cache
was not correctly caching registered vendor views. I wish I'd have looked closer 2 years ago, because I've been testing all day, and everything seems to be working well to me, and I can't find any noticeable change in the framework that would've changed this behavior.With that said, this is a resubmission of that original PR (#31206), with essentially no changes. This change takes Nuno's optimization on compiled views a step further. The root of the problem is the
$this->compiler->isExpired($path)
method is a relatively expensive call, and it can get called a large number of times if:So the goal is to avoid unnecessary calls to
isExpired()
. Nuno's change in #44487 solves scenario 2 by building up a local cache of file paths already compiled, and then checking for the path value in the array on subsequent calls. The changes in this PR actually solve both scenarios because you can now explicitly tell theCompilerEngine
to never check if the path is expired and to assume the file is compiled validly. This is intended to be a production only feature, and will only work if you runphp artisan view:cache
as part of your deployment.So to start, could I first get a little confirmation from others that vendor registered views are being compiling with
artisan view:cache
. After that the PR should be good to review.Check out the previous PR for the performance improvement data.