I'm working on a template that outputs large tables of stockists. At the moment they're quite slow so I've reworked it a bit to use Stash set & get_list but they're still quite slow.
For instance, the template I'm testing has come down from ~9 seconds to ~6.5. I'd like to get that down further and wondering what I can do with the below to achieve that.
{exp:stash:set_list
name="stockists"
parse_tags="yes"
}
{exp:channel:entries
category="{segment_3_category_id}"
channel="stockists"
disable="member_data|pagination|trackbacks"
dynamic="no"
orderby="title"
sort="asc"
}
{stash:stockist_cat}{categories backspace="1"}{category_name}|{/categories}{/stash:stockist_cat}
{stash:stockist_row}
<td>
{title} <br/>
{if stock_address_1}{stock_address_1} <br />{/if}
{if stock_address_2}{stock_address_2} <br />{/if}
{if stock_address_3}{stock_address_3} <br />{/if}
{if stock_city}{stock_city}{/if} {if stock_state}<span>{stock_state}</span>{if:else}<span>{segment_3_category_name}</span>{/if} {if stock_pcode}{stock_pcode}{/if}
</td>
<td>
<p>p {if stock_phone}{stock_phone}<br/>{/if}
{if stock_url}<a href="http://{stock_url}" target="_blank">{stock_url}</a>{/if}</p>
</td>
{/stash:stockist_row}
{/exp:channel:entries}
{/exp:stash:set_list}
<table class="stockists">
<tbody>
{exp:gwcode_categories
cat_id="{segment_3_category_id}"
depth="2|3"
parse="inward"
show_empty="yes"
style="linear"
}
{if depth=="2"}
<tr>
<th colspan="3" id="{cat_url_title}" class="location-hd">{cat_name}</th>
</tr>
{/if}
{if cat_description}<tr>
<td colspan="3"><p>{cat_description}</p></td>
</tr>
{/if}
{if depth=="3"}
{exp:stash:get_list
name="stockists"
match="#\b{cat_name}\b#"
against="stockist_cat"
save="yes"
scope="site"
refresh="60"
replace="no"
}
<tr>
<th scope="row" class="location-name">{cat_name}</th>
{stockist_row}
</tr>
{/exp:stash:get_list}
{/if}
{/exp:gwcode_categories}
</tbody>
</table>