Repository navigation
Speed up the with tag by adding the globals to the new context in place - #5009
nicolas-grekas wants to merge 1 commit into
Conversation
7edd2d8 to
b15f080
Compare
b15f080 to
60d1921
Compare
|
Nice improvement, the two statements avoid one full copy of the context. An optional idea, not blocking: part of the work could be decided at compile time.
The second case is rare in real templates, and a variable that is empty at runtime cannot be detected by the compiler, so I would not expect a measurable gain there. The first case is cheap to implement and makes the generated code shorter. |
$vars + $context + $this->env->getGlobals()copies the whole context twice. Adding the globals in place saves one copy perwithtag, 2.2k instructions with a context of 40 variables.