- Issue created by @nils.destoop
- Merge request !11Resolve #3526218 "Added cache layer for config actions" → (Open) created by nils.destoop
When an entity is being viewed. The entity type behaviors are also loaded. This uses the BehaviorConfigFactory to load all supported entity type behaviors for a given entity type / bundle.
However, the result of a scan is not cached. So when loading a page with a lot of entities, this leads to an unnecessary amount of of listing the config.
Example. We have 435 entities that are being loaded on an empty render cache.
This leads to almost 11k calls to getConfiguredBehaviors.
The getConfiguredBehaviors calls 11k times the getConfigDataForEntityTypeAndBundle. While the getConfigDataForEntityTypeAndBundle 11k times calls unserialize on the data.
getConfiguredEntityTypesAndBundles (called 435 times) also requests a listing of all the config every time and scans the list for behaviors.
$configNames = $this->configFactory->listAll($prefix);
The impact here isn't the same as the getConfiguredBehaviors, as core has static cache for the listing. But we shouldn't request it, if we already have calculated the configured ones before.
Clear the cache and go to a random page with multiple entities on. After that also go to a second page.
At least introduce static cache. But we probably can also extend it to cache the result permanently. Configured behaviors only change when changing config. So there is no need to calculate this every time.
Implement cache
Active
2.1
Code