Quantcast
Viewing all articles
Browse latest Browse all 297255

Drupal\Core\Config\FileStorage::getAllCollectionNamesHelper should use some caching

Problem/Motivation

I have a project with a lot of configurations (3 037, mostly because of multiple languages). The site installation from existing configuration (drush site:install --existing-config) takes about 10 minutes. I did profile the installation and this is the TOP 10 slow calls:

Image may be NSFW.
Clik here to view.
TOP 10 calls before

As you can see, Drupal\Core\Config\FileStorage->getAllCollectionNamesHelper() is the slowest operation during installation.

Also, take a look at php::SplFileInfo->isDir(). It called 13'937'541 times, and almost all the calls (13'919'940) comes from Drupal\Core\Config\FileStorage->getAllCollectionNamesHelper(), but php::SplFileInfo->isDir() is slow by itself:

Image may be NSFW.
Clik here to view.
SplFileInfo before

This is clearly because Drupal\Core\Config\FileStorage->getAllCollectionNamesHelper() doesn't cache its result in any way. It's always calculated in runtime. It seems to me like a bottleneck.

Steps to reproduce

Install the website from existing configs and profile it. The more configs you have, the more problems you will see.

Proposed resolution

Provide at least a static caching for the results of this method.

Remaining tasks

  1. Provide a patch with a static caching and see how tests are going.
  2. Decide should it be cached and how.
  3. Implement it.

Viewing all articles
Browse latest Browse all 297255

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>