Repository navigation
[6.x] Make each taxonomy into an array once per terms listing - #15876
Merged
jasonvarga merged 1 commit intoNov 18, 2026
Merged
Conversation
Every term in a Control Panel terms listing included its taxonomy's augmented array, made again for each term. Share them across the listing so each taxonomy is made into an array once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Every term in a Control Panel terms listing includes its taxonomy as
'taxonomy' => $term->taxonomy()->toArray(). That's the taxonomy's full augmented array, URLs included, and it was made again for every term on the page. All the terms in a listing share one taxonomy (or a few, in the Terms fieldtype's listing), so a page of 50 terms built the same array 50 times. That was most of the listing's time.Termsnow gives itsListedTerms a shared place to keep each taxonomy's array, keyed by handle, so each taxonomy is made into an array once per listing. AListedTermused on its own, without one, makes the array as before.The response is unchanged.
Tests
the_taxonomy_is_only_made_into_an_array_once_per_listinglists three terms with aTaxonomysubclass that countstoArray()calls. It's called 3 times before this change and once after, and every term'staxonomystill matchesTaxonomy::toArray().each_term_gets_its_own_taxonomy_when_listing_terms_from_severalcovers a listing that mixes taxonomies, as the Terms fieldtype's can.Benchmark
The terms listing endpoint (
/cp/taxonomies/tags/terms, 50 per page) requested as a super user, alternating between6.x(255b35f) and this branch 6 times. Each request is a fresh PHP process with a warm Stache; medians shown (Apple Silicon, PHP 8.4). The response was identical on both.6.xThe branch was faster in all 12 pairs.
🤖 Generated with Claude Code