flat hirachy
panel subviews slow down if folder contains too many subfolders. for 1000 pages better create 20 x 50 than put 1000 in one folder. the panel subviews parse each contained folder – the more the slower. see more here.
site()->index()
this function gets all pages you have in content
. this is not fast if you have a lot. usually you do not need all but a filtered set of them. if you have lots (like 500 or more) pages it might be faster to iterate of the childs yourself and use filterBy()
etc. pseudo example…
// get all 20k exposes nested in 10k projects (root: project):
$allProjectMaybeSlow = site()->index()->filterBy('template', 'expose');
$allProjectsFaster = array(); // array
foreach(page('projects')->children()->filterBy('template', 'project')->children()->filterBy('template', 'expose') as $expose) {
$allProjectsFaster[] = $expose;
}
$allProjectsFaster = new Pages($allProjectsFaster); // Pages Collection
cache
if your content is static you could remove the impact of site()->index()
by turning on caching. or just cache the result of your filter-query.
root of all evil
like always measure first and optimise only if needed.