From 8e169e4457a9f7b21dea19f2a24b03d73a64d1e9 Mon Sep 17 00:00:00 2001 From: Geoffrey Tran Date: Fri, 15 Jul 2011 20:52:23 -0500 Subject: [PATCH] Improved performance when assetic's use_controller is enabled When assetic's use_controller is enabled, assetic has to loop through all the templates and create TemplateReferences through the assetic FileResource. This in turn causes a lot of calls to getLogicalName() leading to 5x the calls to the TemplateReference's get() (16k in my case). By accessing the protected field directly compared to using get() we achieve better performance during development (33% in my case). --- .../Bundle/FrameworkBundle/Templating/TemplateReference.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateReference.php b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateReference.php index 2fd135f61a..65a5779b2e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateReference.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateReference.php @@ -52,6 +52,6 @@ class TemplateReference extends BaseTemplateReference */ public function getLogicalName() { - return sprintf('%s:%s:%s.%s.%s', $this->get('bundle'), $this->get('controller'), $this->get('name'), $this->get('format'), $this->get('engine')); + return sprintf('%s:%s:%s.%s.%s', $this->parameters['bundle'], $this->parameters['controller'], $this->parameters['name'], $this->parameters['format'], $this->parameters['engine']); } }