remove additional calls to getCached()

This commit is contained in:
Simon Wisselink
2023-02-03 17:11:26 +01:00
parent 7408c18cdc
commit 864643f2c9
2 changed files with 10 additions and 8 deletions

View File

@@ -3,7 +3,6 @@
## Performance improvements
- context: pass template variables in an array
- why do we do 300k assign() calls? (answer: foreach?)
- debugging: see if removing debugging code speeds up
## Review direct variable property access
- review ->value{$index} in ForTag

View File

@@ -266,12 +266,13 @@ class Template extends TemplateBase {
$tpl->defaultScope = $scope;
}
// recursive call ?
if ($tpl->templateId !== $this->templateId && $caching !== \Smarty\Template::CACHING_NOCACHE_CODE) {
$tpl->getCached(true);
} else {
// re-use the same Cache object across subtemplates to gather hashes and file dependencies.
$tpl->setCached($this->getCached());
if ($caching) {
if ($tpl->templateId !== $this->templateId && $caching !== \Smarty\Template::CACHING_NOCACHE_CODE) {
$tpl->getCached(true);
} else {
// re-use the same Cache object across subtemplates to gather hashes and file dependencies.
$tpl->setCached($this->getCached());
}
}
foreach ($extra_vars as $_key => $_val) {
@@ -713,7 +714,9 @@ class Template extends TemplateBase {
public function setCompileId($compile_id) {
parent::setCompileId($compile_id);
$this->getCompiled(true);
$this->getCached(true);
if ($this->caching) {
$this->getCached(true);
}
}
/**