Repository navigation
[6.x] Look up each tree page's entry once when building the CP tree - #15812
Open
DanielDarrenJones wants to merge 1 commit into
Open
DanielDarrenJones wants to merge 1 commit into
DanielDarrenJones wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The navigation and collection tree endpoints transform every page with
TreeBuilder::transformTreeForController(). For each page it looked the entry up again for almost every key it filled in, fetched the entry's blueprint twice, and resolved the current user for every page.It now looks the entry and blueprint up once per page and the user once per level, in a plain loop. The output is the same.
Benchmark
A generated site on 6.40.0. Each request runs in its own PHP process, as PHP-FPM serves it (boot not timed, opcache on), median of 5, on an M1 Pro with PHP 8.5.
The JSON is byte-identical to stock, and the tree pages render identically in the CP.
Tests
ViewNavigationTreeTestasserts the exact JSON for a tree with entry pages, a custom title, a redirect, a draft, a nested child, a link, a text-only page, a missing entry, and a user who can't delete entries. It passes both before and after the change.The full suite passes.