Module version(s) affected
all versions
Description
I'm working on a page with 100k+ pages that have 4 elemental areas. I was tasked to check for performance optimizations and found out that when opening a page in CMS, 4-5 seconds were used for loading up those elemental areas (not elementals). To be specific, initialization of elemental areas triggered ~10 querys to get the owner (page) of the area. Each of those query took ~0.4s and that quickly added up.
As per these instructions TopPageID field is already being added (and populated) to ElementalArea table, but to my surprise ElementalArea::getOwnerPage doesn't seem to be using it at all and is instead doing plenty of loops and queries to DB.
How to reproduce
- install Elemental
- add many page
- open a page in CMS and monitor performance
Possible Solution
if ($this->hasExtension(DataExtension::class) && ($this->TopPageID > 0)) {
return $this->TopPage();
}
The above code added to ElementalArea::getOwnerPage improves page load time for 50% in my case. (although I do have many areas and lots of pages)
Additional Context
No response
Validations
Module version(s) affected
all versions
Description
I'm working on a page with 100k+ pages that have 4 elemental areas. I was tasked to check for performance optimizations and found out that when opening a page in CMS, 4-5 seconds were used for loading up those elemental areas (not elementals). To be specific, initialization of elemental areas triggered ~10 querys to get the owner (page) of the area. Each of those query took ~0.4s and that quickly added up.
As per these instructions TopPageID field is already being added (and populated) to ElementalArea table, but to my surprise ElementalArea::getOwnerPage doesn't seem to be using it at all and is instead doing plenty of loops and queries to DB.
How to reproduce
Possible Solution
The above code added to ElementalArea::getOwnerPage improves page load time for 50% in my case. (although I do have many areas and lots of pages)
Additional Context
No response
Validations
silverstripe/installer(with any code examples you've provided)