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
1 Answer 1
\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).
Explore related questions
See similar questions with these tags.