Skip to content

[6.x] Work out what an assets field preloads about its container once - #15893

Merged
jasonvarga merged 1 commit into
statamic:6.xfrom
DanielDarrenJones:perf/6x-assets-fieldtype-preload
Nov 13, 2026
Merged

jasonvarga merged 1 commit into
statamic:6.xfrom
DanielDarrenJones:perf/6x-assets-fieldtype-preload

Conversation

@DanielDarrenJones

Copy link
Copy Markdown
Contributor

An assets field works out the same things about its container every time one is preloaded: its title and URLs, five permission checks for the current user, and the listing columns with the user's column preferences applied.

That's once per assets field on an entry form, which is small. The asset browser is where it adds up: the actions for each row are built with their fields, one of them has an assets field, and so a folder of 50 assets does all of it 50 times over.

The container's details and the columns are now each worked out once per request, for the container and the current user, and kept in Blink. getColumns() hands out clones of the columns it remembered, so anything changing the ones it was given doesn't change anyone else's.

Numbers

The asset browser's folder requests, each in its own process, four alternating rounds of eight:

before after
root of a container 143.9 ms 130.9 ms -9.0%
a folder of 50 assets 165.3 ms 150.3 ms -9.1%

Entry forms came out within noise. Every response is byte for byte the same.

Tests

Two fields on the same container make the permission checks of one (fails without the change: 12 checks rather than 6). Two more pin what should stay true and pass before and after: each field gets column objects of its own, and what's remembered for one user isn't given to another.

@jasonvarga
jasonvarga merged commit bf5db40 into statamic:6.x Nov 13, 2026
62 checks passed
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