Symfony2 和 Twig 渲染性能问题 [英] Symfony2 and Twig render performance issues

查看:76
本文介绍了Symfony2 和 Twig 渲染性能问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

就像在本主题中,在开发模式下添加我的应用程序中的树枝渲染"标签(相关文档:嵌入控制器).

Just like in this topic, I have a performance issue in dev mode when adding a twig "render" tag in my app (related documentation: Embedding controllers).

如果没有这个渲染标签,我的页面生成时间不到 70 毫秒.使用渲染标签,它至少是 170 毫秒.并且在应用程序中添加的每个渲染标记都会使页面生成增加 100 毫秒(这是很多:为什么正常页面在 60 毫秒内运行而渲染标记在 100 毫秒内运行?).我的应用程序的每个页面上可能需要 4 或 5 个,因此这意味着在开发模式下每个页面至少需要 500 毫秒.

Without this render tag, my pages are generated in less than 70 ms. With the render tag, it's at least 170 ms. And each render tag added in the app increases the page generation by 100 ms (which is A LOT : why does a normal page run in 60 ms and a render tag in 100 ms?). I may need 4 or 5 of them on every page of my app, so that would mean at least 500 ms for each page in dev mode.

我完全理解 prod 模式没有问题,但它在开发中显然不舒服.那么,在开发模式下使用render"标签时,有人知道有什么方法可以摆脱任何无用的调用、日志或代码吗?

I totally understand that there is no problem in prod mode, but it's clearly not comfortable in development. So, does somebody know any way to get rid of any useless calls, logs or code while using "render" tag in dev mode?

推荐答案

我有 在 10 小时前解释了.长话短说:迁移到 Twig 扩展.

I have explained it just 10 hours ago. Long story short: migrate to Twig extensions.

这篇关于Symfony2 和 Twig 渲染性能问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆