Skip to content

[6.x] Speed up Stache warming for large structured collections#14781

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
o1y:memoize-structure-tree-lookups
Jun 9, 2026
Merged

[6.x] Speed up Stache warming for large structured collections#14781
jasonvarga merged 1 commit into
statamic:6.xfrom
o1y:memoize-structure-tree-lookups

Conversation

@o1y

@o1y o1y commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Warming a structured collection got slower and slower as entries piled up. Each entry resolved its order, URI and parent from the structure tree and every one of those lookups rebuilt a full keyed map over all pages from scratch. The flattened page list was cached but the derived maps weren't. In this commit they are now memorized and built once per tree.

Most sites will never hit this issue. It only adds up when:

  • The collection is structured / orderable: true
  • It has many entries. The cost is quadratic. So it is only painful in the thousands.
  • The stache is cold.

10000 entry structured collection:
stache:warm: ~117s => ~59s. 🚤💨

@jasonvarga jasonvarga merged commit 8773b2b into statamic:6.x Jun 9, 2026
19 checks passed
@o1y o1y deleted the memoize-structure-tree-lookups branch June 20, 2026 16:33
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