The combination of module_list(), drupal_load() and the functions they call make numerous queries to the system table, which could probably all be consolidated into a single cached array.
This is a sample from a logged in request to the front page on a vanilla install with no content. I'm pretty sure there are others lurking around too we could consolidate.
0.4 drupal_get_filename() SELECT filename FROM system WHERE name = :name AND type = :type
1.15 module_list() SELECT name, filename FROM system WHERE type = 'module' AND status = 1 ORDER BY weight ASC, name ASC
0.4 system_region_list() SELECT info FROM system WHERE type = :type AND name = :name
0.63 list_themes() SELECT * FROM system WHERE type = :theme
I haven't yet looked at how this could be consolidated, but probably a first step would be a system_info() function which returns an array looking something like $type[$name][$info]. If we can do this in a single query and build the array cheaply, all the better, if it's not super-cheap to build, we could then add a cache_get()/cache_set() in there - which would definitely remove at least one or two queries from cached requests on sites running memcache and page caching.
While none of the query times in themselves are particularly bad, we run at least some of these on cached pages too, and PDO itself takes a fair bit of time processing and executing each query.
It's quite possible that this will require some function signature changes, so marking critical in the hope we can have a serious look at the benefits (or not) before October 15th.
Comments
Comment #1
catchStart with an easy one #591758: system_region_list() should use list_themes() instead of a direct db_query().
Comment #2
sunSee also #561452: Add API function to get module/theme info without rebuilding it.
Comment #3
catchForgot about this one, done elsewhere.