Skip to content

Speed up the with tag by adding the globals to the new context in place - #5009

Open
nicolas-grekas wants to merge 1 commit into
twigphp:3.xfrom
nicolas-grekas:with-tag-globals-merge-3x
Open

nicolas-grekas wants to merge 1 commit into
twigphp:3.xfrom
nicolas-grekas:with-tag-globals-merge-3x

Conversation

@nicolas-grekas

Copy link
Copy Markdown
Contributor

$vars + $context + $this->env->getGlobals() copies the whole context twice. Adding the globals in place saves one copy per with tag, 2.2k instructions with a context of 40 variables.

Comment thread src/Node/WithNode.php
@nicolas-grekas
nicolas-grekas force-pushed the with-tag-globals-merge-3x branch from 7edd2d8 to b15f080 Compare October 20, 2026 12:09
@nicolas-grekas
nicolas-grekas force-pushed the with-tag-globals-merge-3x branch from b15f080 to 60d1921 Compare October 27, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants