Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb76ffad

Browse files
committed
minor#4464 [BestPractices Removing micro-optimization note about@template (weaverryan)
This PR was submitted for the master branch but it was merged into the 2.3 branch instead (closes#4464).Discussion----------[BestPractices Removing micro-optimization note about@template| Q | A| --- | ---| Doc fix? | no| New docs? | no| Applies to | 2.3+| Fixed tickets | -Hi guys!I think that a small performance gain is not a *great* reason to recommend something. And really, this was not the most important reason for recommending against `@Template`. I think it's clearer to focus on the real reason, and not get into performance (we could argue against using any feature because of performance).Thanks!Commits-------f439498 Removing micro-optimization note about@template
2 parentsb3e204c +f439498 commitb76ffad

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

‎best_practices/controllers.rst

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,15 @@ Template Configuration
7676
Don't use the ``@Template()`` annotation to configure the template used by
7777
the controller.
7878

79-
The ``@Template`` annotation is useful, but also involves some magic. For
80-
that reason, we don't recommend using it.
79+
The ``@Template`` annotation is useful, but also involves some magic. We
80+
don't think its benefit is worth the magic, and so recommend against using
81+
it.
8182

8283
Most of the time, ``@Template`` is used without any parameters, which makes
8384
it more difficult to know which template is being rendered. It also makes
8485
it less obvious to beginners that a controller should always return a Response
8586
object (unless you're using a view layer).
8687

87-
Lastly, the ``@Template`` annotation uses a ``TemplateListener`` class that hooks
88-
into the ``kernel.view`` event dispatched by the framework. This listener introduces
89-
a measurable performance impact. In the sample blog application, rendering the
90-
homepage took 5 milliseconds using the ``$this->render()`` method and 26 milliseconds
91-
using the ``@Template`` annotation.
92-
9388
How the Controller Looks
9489
------------------------
9590

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp