GordonLesti / Lesti_Fpc

Simple Magento Fullpagecache
https://gordonlesti.com/lesti-fpc-documentationversion-1-4-5/
Other
358 stars 159 forks source link

Avoid reparsing of layout XML when not necessary #291

Closed nussjustin closed 7 years ago

nussjustin commented 7 years ago

Before this commit on each request to a cached page the layout XML would be formatted as a string and then parsed into a new object of type Lesti_Fpc_Helper_Data::LAYOUT_ELEMENT_CLASS.

This is unnecessary as we only read from the layout and the existing layout root node is already a SimpleXMLElement, which has all methods we need.

This saves around 60ms on my local dev environment with PHP 7.0 and Magento 1.9.3.1. Most of the saving comes from not calling getXmlString which internally calls asNiceXml on the layout root node.

GordonLesti commented 7 years ago

@nussjustin Thank you.