Skip to content

[6.x] Skip Antlers for site values that are only config - #15887

Merged
jasonvarga merged 2 commits into
statamic:6.xfrom
DanielDarrenJones:perf/6x-site-config-values
Nov 13, 2026
Merged

jasonvarga merged 2 commits into
statamic:6.xfrom
DanielDarrenJones:perf/6x-site-config-values

Conversation

@DanielDarrenJones

Copy link
Copy Markdown
Contributor

Every request boots the Antlers runtime to work out the site's name and URL, even though there is usually nothing in them for Antlers to do.

The default resources/sites.yaml has name: '{{ config:app.name }}' and url: '{{ config:app.url }}'. Site::resolveAntlersValue() puts the config values in with Parse::config() and then hands the result, by now a plain string like My Site, to the runtime parser.

When what's left after the config values are in has no {, @ or < in it, it's now returned as it is (still through sanitizePhp(), as before). Anything that could still be Antlers, a Blade-style directive or a component tag goes to the parser as it always did.

Numbers

Two sites with three config expressions each, timed around resolveAntlersValue():

before after
first resolve in a request 2.7 to 7.5 ms 0.2 to 0.75 ms
each one after that ~1 ms ~0.02 ms

The first one is the cost that matters: on a page that doesn't otherwise use Antlers at that point, the runtime is no longer loaded during boot.

Tests

One test pins what eight shapes of value resolve to (PHP tags, HTML, an @, numbers, empty and missing config, whitespace), and passes before and after. A value that is only config doesn't reach the parser, and a config value holding a component tag still does; both of those fail without the change or its guard.

A site's name and URL are usually nothing but a config expression, which is
replaced before Antlers is asked to parse what's left. When nothing is left
to parse, the value is returned as it is, sanitized as any other plain value.
@jasonvarga
jasonvarga merged commit 569b589 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