Repository navigation
[6.x] Make each term once when building term indexes - #15871
Merged
jasonvarga merged 1 commit intoNov 12, 2026
Merged
Conversation
Every entry that uses a term adds an association, and the value indexes made a term for every association before keeping one per site and slug. Group the associations first so each term is made 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.
A taxonomy's
associationsindex has a row for every term each entry uses, so 10,000 entries with three tags each is about 30,000 rows for a couple of hundred tags.When
Terms\Valuebuilt a term index (id,path,slug,site,title, and any other value index on a terms store), it made aTermfor every row and then kept one persite::slugwithmapWithKeys(). Building the same term again and again added up: on a cold warm, the term value indexes were the single biggest cost, ahead of loading the entries themselves.The associations are now grouped by site and slug first, and each term is made once.
Same result
A term made from an association depends only on its site and slug (the title is set to the slug as well), so every duplicate produced the same value. The index items, their keys and their order are unchanged, and term files still win over terms made from associations.
TermValueIndexTestchecks the indexes against the old one-term-per-association result, including multisite and a term with a file.Benchmark
stache:warmfrom a cleared cache andstache:refresh, alternating between6.x(7097691) and this branch 4 times so both see the same machine conditions. Each run is a fresh PHP process; medians shown (Apple Silicon, PHP 8.4). The site is generated: dated articles with 1–5 tags (skewed usage) and a category each, plus a structured pages collection. Tags are N/50 (min 50), and there are 12 categories.6.xThe branch was faster in all 16 pairs. Peak memory is unchanged.
🤖 Generated with Claude Code