I have just launched a new Magento 1.9.1.4 site that has been in development for a long time. Right before launch, I went through my "speed up" checklist:
- Compilation: on
- Caching: on
- Flat databases: on
- Combine CSS/JS: on
- Logging: off
- GZip: on
- Plus several other trivial tweaks...
However, I was still getting a page load time of 12-16 seconds on my category pages! After enabling the profiler, I started at the bottom of the list (innermost child code?) and found the following lines with high time and memory usage:
| Code Profiler | Time | Cnt | Emalloc | RealMem |
|---------------|------|-----|---------|---------|
| frontend/{package}/{theme}/template/catalog/product/price.phtml | 10.1435 | 27 | 14,295,328 | 20,971,520 |
|---------------|------|-----|---------|---------|
| CONFIGURABLE:Mage_Catalog_Model_Product_Type_Configurable::getConfigurableAttributes | 9.8808 | 27 | 13,653,472 | 19,398,656 |
|---------------|------|-----|---------|---------|
| TTT2:Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection::_afterLoad | 3.3624 | 27 | 9,510,240 | 15,204,352 |
| CONFIGURABLE:Amasty_Conf_Model_Catalog_Product_Type_Configurable::getUsedProducts | 3.3584 | 108 | 10,730,968 | 15,204,352 |
|---------------|------|-----|---------|---------|
| TTT4:Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection::_afterLoad | 5.1512 | 27 | 3,266,096 | 3,407,872 |
|
So, thinking I royally screwed up the code in my theme's price.phtml
, I removed it from the server to test using Magento's default price.phtml
. However, I found that code to be only marginally better:
| Code Profiler | Time | Cnt | Emalloc | RealMem |
|---------------|------|-----|---------|---------|
| frontend/base/default/template/catalog/product/price.phtml | 8.8124 | 27 | 14,278,832 | 20,971,520 |
|---------------|------|-----|---------|---------|
| CONFIGURABLE:Mage_Catalog_Model_Product_Type_Configurable::getConfigurableAttributes | 8.6064 | 27 | 13,649,584 | 19,136,512 |
|---------------|------|-----|---------|---------|
| TTT2:Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection::_afterLoad | 3.0117 | 27 | 9,509,048 | 14,942,208 |
| CONFIGURABLE:Amasty_Conf_Model_Catalog_Product_Type_Configurable::getUsedProducts | 3.0080 | 108 | 10,730,480 | 14,942,208 |
|---------------|------|-----|---------|---------|
| TTT4:Mage_Catalog_Model_Resource_Product_Type_Configurable_Attribute_Collection::_afterLoad | 4.4072 | 27 | 3,263,456 | 3,407,872 |
|
So, it seems that I'm missing something here to get the site/server into production mode or something is really messed up with the product structure. Can someone lend a hand as to why Magento's default files (and my custom theme files) are taking so long to load after optimization?
Note: The above specs are from a category page in grid view with 27 products (obviously from the "Cnt" column).
catalog/product/price.phtml
this file really makes trouble with performance. Core Magento code is not at all optimized here I believe.price.html
as a reference, but surely Magento's core files can do better than 9 seconds on a single block of code!