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

View File

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