1

I have enabled the new relic log to check the performance of the Magento 2 website. On home page I am rendering 5 blocks with 5 template files. In new relic logs, it shows homepage takes time to render Magento\Framework\View\TemplateEngine\Php::render function, Do you have any clue why it happening ?

Here is screenshot enter image description here

asked Jul 11, 2022 at 5:06

1 Answer 1

0

\Magento\Framework\View\TemplateEngine\Php is default template engine for .phtml files (Magento Blocks). See \Magento\Framework\View\Element\Template::fetchView.

This means that all templates are run with $templateEngine->render($this->templateContext, $fileName, $this->_viewVars).

In any template file if you check get_class($this) you will receive instance of \Magento\Framework\View\TemplateEngine\Php. The $block variable is assigned to template block. TemplateEngine has logic to pass methods to $block. If in you code you call $this->getSome() it will be translated to $block->getSome().

In your example means that Magento\Framework\View\TemplateEngine\Php::render processed 53 .phtml files and this took 877 ms (including any lazy logic from blocks).

answered Jul 11, 2022 at 22:58

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.