Newest Edit - 27 Feb 2014 - In case some poor soul with the same issue stumbles on this thread, I did not find a solution and ended up removing Matrix and replacing it with Grid.
My company would like to upgrade EE from 2.5.2 to the latest 2.7.2
I have created a sandboxed copy of our website, and executed the upgrade.
As a result, our template for our products page went from an execution time of approximately two seconds to an execution time of over sixty seconds.
After a lot of trial and error, I have broken it down to one particular chunk of code. The code works just fine in the old version of EE, but not in the new version.
See the following code (edited to correct conditionals as per commenters statements):
{if cf_product_options}
{if entry_id==20}
<hr class="soften">
<h2>Configuration Options</h2>
<table class="table table-striped table-bordered table-condensed table-disable-hover">
<thead>{cf_product_options_labels limit="1"}<tr><th width="50%">{col_1}</th><th width="50%">{col_2}</th></tr>{/cf_product_options_labels}</thead>
<tbody>{cf_product_options limit="1"}<tr> <td>{col_1}</td><td>{col_2}</td></tr>{/cf_product_options}</tbody>
</table>
{/if}
{if entry_id==22}
<hr class="soften">
<h2>Configuration Options</h2>
<table class="table table-striped table-bordered table-condensed table-disable-hover">
<thead>{cf_product_options_labels limit="1"}<tr><th width="50%">{col_1}</th><th width="50%">{col_2}</th></tr>{/cf_product_options_labels}</thead>
<tbody>{cf_product_options limit="1"}<tr> <td>{col_1}</td><td>{col_2}</td></tr>{/cf_product_options}</tbody>
</table>
{/if}
{if entry_id==76}
<hr class="soften">
<h2>Typical Options <small>( <span style="font-size:12px;">*</span> ) represents standards features</small></h2>
<table class="table table-striped table-bordered table-condensed table-disable-hover">
<thead>{cf_product_options_labels limit="1"}<tr><th width="33%">{col_1}</th><th width="33%">{col_2}</th><th width="33%">{col_3}</th></tr>{/cf_product_options_labels}</thead>
<tbody>{cf_product_options limit="1"}<tr><td>{col_1}</td><td>{col_2}</td><td>{col_3}</td></tr>{/cf_product_options}</tbody>
<thead>{cf_product_options_labels limit="1"}<tr><th width="33%">{col_4}</th><th width="33%">{col_5}</th><th width="33%">{col_6}</th></tr>{/cf_product_options_labels}</thead>
<tbody>{cf_product_options limit="1"}<tr><td>{col_4}</td><td>{col_5}</td><td>{col_6}</td></tr>{/cf_product_options}</tbody>
</table>
{/if}
{if entry_id==77}
<hr class="soften">
<h2>Compatible Options</h2>
<table class="table table-striped table-bordered table-condensed table-disable-hover">
<tbody>{cf_product_options limit="1"}<tr><td>{col_1}</td><td>{col_2}</td><td>{col_3}</td></tr>{/cf_product_options}</tbody>
</table>
{/if}
{if entry_id==79}
<hr class="soften">
<h2>Typical Options <small>( <span style="font-size:12px;">*</span> ) represents standards features</small></h2>
<table class="table table-striped table-bordered table-condensed table-disable-hover">
<thead>{cf_product_options_labels limit="1"}<tr><th width="20%">{col_1}</th><th width="20%">{col_2}</th><th width="20%">{col_3}</th><th width="20%">{col_4}</th><th width="20%">{col_5}</th></tr>{/cf_product_options_labels}</thead>
<tbody>{cf_product_options limit="1"}<tr><td>{col_1}</td><td>{col_2}</td><td>{col_3}</td><td>{col_4}</td><td>{col_5}</td></tr>{/cf_product_options}</tbody>
</table>
{/if}
{if entry_id==89}
<hr class="soften">
<h2>Typical Options</h2>
<table class="table table-striped table-bordered table-condensed table-disable-hover">
<tbody>{cf_product_options limit="1"}<tr><td width="50%">{col_1}</td><td width="50%">{col_2}</td></tr>{/cf_product_options}</tbody>
</table>
{/if}
{if entry_id==101}
<hr class="soften">
<h2>Typical Options <small>( <span style="font-size:12px;">*</span> ) represents standards features</small></h2>
<table class="table table-striped table-bordered table-condensed table-disable-hover">
<thead>{cf_product_options_labels limit="1"}<tr><th width="16%">{col_1}</th><th width="16%">{col_2}</th><th width="16%">{col_3}</th><th width="16%">{col_4}</th><th width="16%">{col_5}</th><th width="16%">{col_6}</th></tr>{/cf_product_options_labels}</thead>
<tbody>{cf_product_options limit="1"}<tr><td>{col_1}</td><td>{col_2}</td><td>{col_3}</td><td>{col_4}</td><td>{col_5}</td><td>{col_6}</td></tr>{/cf_product_options}</tbody>
</table>
{/if}
{/if}
Above, in the code, "cf_product_options" is a matrix field. The code checks with the first conditional to see that data exists, and if so, it checks the entry_id and serves up the appropriate code.
Removing this chunk of code entirely returns the execution time to normal.
(I was originally using a switchee statement here, and while that works in our old version of EE, it is JUST as slow here in the updated version... so I have removed switchee code for the time being to simplify and make it easier to see what is going on)
Thank you for any suggestions.
* DEBUGGING *
Here is the output from the debugging in EE (when I use switchee in addition to the code above):
(0.375135 / 19.24MB) Calling Class/Method: Channel/entries
(0.383207 / 19.28MB) -> Class Called: Channel
(0.385074 / 19.29MB) -> Method Called: entries
(0.393458 / 19.40MB) Calling Extension Class/Method: Assets_ext/channel_entries_query_result
(0.411238 / 19.58MB) Calling Extension Class/Method: Playa_ext/channel_entries_tagdata
(0.413006 / 19.61MB) Calling Extension Class/Method: Matrix_ext/channel_entries_tagdata
(36.993778 / 21.28MB) Calling Extension Class/Method: Pt_field_pack_ext/channel_entries_tagdata
(37.032971 / 21.14MB) Calling Extension Class/Method: Playa_ext/channel_entries_tagdata
(37.034998 / 21.17MB) Calling Extension Class/Method: Matrix_ext/channel_entries_tagdata
(69.008183 / 21.34MB) Calling Extension Class/Method: Pt_field_pack_ext/channel_entries_tagdata
(69.041813 / 20.97MB) -> Data Returned
Here is the debugging, after removing switchee and using a fix as suggested below:
(0.886224 / 19.24MB) Calling Class/Method: Channel/entries
(0.892344 / 19.27MB) -> Class Called: Channel
(0.896914 / 19.29MB) -> Method Called: entries
(0.954155 / 19.39MB) Calling Extension Class/Method: Assets_ext/channel_entries_query_result
(1.011197 / 19.57MB) Calling Extension Class/Method: Playa_ext/channel_entries_tagdata
(1.017665 / 19.59MB) Calling Extension Class/Method: Matrix_ext/channel_entries_tagdata
(19.454163 / 21.26MB) Calling Extension Class/Method: Pt_field_pack_ext/channel_entries_tagdata
(19.519405 / 21.13MB) Calling Extension Class/Method: Playa_ext/channel_entries_tagdata
(19.521837 / 21.16MB) Calling Extension Class/Method: Matrix_ext/channel_entries_tagdata
(33.768249 / 21.32MB) Calling Extension Class/Method: Pt_field_pack_ext/channel_entries_tagdata
(33.818316 / 20.96MB) -> Data Returned
With suggested UPDATE2 the debug output:
(0.826544 / 19.24MB) Calling Class/Method: Channel/entries
(0.832316 / 19.28MB) -> Class Called: Channel
(0.835756 / 19.29MB) -> Method Called: entries
(0.853860 / 19.40MB) Calling Extension Class/Method: Assets_ext/channel_entries_query_result
(0.878189 / 19.57MB) Calling Extension Class/Method: Playa_ext/channel_entries_tagdata
(0.880296 / 19.60MB) Calling Extension Class/Method: Matrix_ext/channel_entries_tagdata
(18.803853 / 21.26MB) Calling Extension Class/Method: Pt_field_pack_ext/channel_entries_tagdata
(18.863077 / 21.13MB) Calling Extension Class/Method: Playa_ext/channel_entries_tagdata
(18.865144 / 21.16MB) Calling Extension Class/Method: Matrix_ext/channel_entries_tagdata
(35.012716 / 21.32MB) Calling Extension Class/Method: Pt_field_pack_ext/channel_entries_tagdata
(35.067242 / 20.96MB) -> Data Returned
Total Execution time: 37.3617
UPDATE:
I know that this is related to the matrix field in particular. If I remove the matrix field and simply use the if/else conditionals to display regular html code, the load time drops to just 3 seconds.
Add a matrix field and try to display it's contents, and suddenly the execution seems to multiply exponentially for each if/else that exists.
UPDATE 2
To simplify debugging, I have stripped the problem area of my template to contain the following plain html code: (note that there is plenty more to the template, just not shown here)
I can't seem to force my post to remove html code between my code tags, so I have substituted regular brackets for now
(hr class="soften") (h2)Configuration Options(/h2)
Which has a total execution time of: 2.5+ seconds
If I add my matrix field to that simple code like so:
(hr class="soften") (h2)Configuration Options(/h2) {cf_product_options_labels limit="1"}{col_1}{col_2}{/cf_product_options_labels} {cf_product_options limit="1"}{col_1}{col_2}{/cf_product_options}
Total Execution time jumps to: 4.6+ seconds
The debug looks the same as all the other problem debugs with the execution time jumping drastically when calling " Matrix_ext/channel_entries_tagdata " and " Pt_field_pack_ext/channel_entries_tagdata "
Unfortunately, I have contacted P&T and they responded that there would be a fee to help as debugging a template falls outside the normal scope of their support. Fair enough. I believe I have narrowed it enough right now and have sent them another email, so hopefully they will have ideas on where to go next. I'm at a complete loss.
NEW EDIT: I thought I had this issue licked, but it turns out I didn't. In my excitement over an improved load time, I didn't notice that by embedding my template, I of course was not actually rendering the matrix data, and instead was just displaying variable names. I hadn't edited the template to take into account that I would have to pass the entry_id to the embedded template in order for it to show relevant data.
So this is still unsolved, and I believe I'm going to have to do a MASSIVE amount of work to use an alternate solution.
Playa_ext/channel_entries_tagdata (0.413006 / 19.61MB) Calling Extension Class/Method: Matrix_ext/channel_entries_tagdata (36.993778 / 21.28MB)
? What does this same template look like, at those two steps, in 2.5.2? Also, what's your phpmemory_limit
on the 2.5.2 machine vs the 2.7.2 machine? Note though I'm not optimistic that this is a simple memory issue, but it's always worth double-checking.