diff --git a/TODO.txt b/TODO.txt index d7378442..59779ef1 100644 --- a/TODO.txt +++ b/TODO.txt @@ -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 diff --git a/src/Template.php b/src/Template.php index 0d0018db..1c7fdf9b 100644 --- a/src/Template.php +++ b/src/Template.php @@ -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); + } } /**