浏览代码

merged branch geoffreytran/assetic-debug-performance (PR #1728)

Commits
-------

8e169e4 Improved performance when assetic's use_controller is enabled

Discussion
----------

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).

---------------------------------------------------------------------------

by beberlei at 2011/07/18 11:22:43 -0700

+1 - assetic is a huge performance drain for my app in dev mode aswell.
Fabien Potencier 14 年之前
父节点
当前提交
3e2ba60738
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      src/Symfony/Bundle/FrameworkBundle/Templating/TemplateReference.php

+ 1 - 1
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']);
     }
 }