When looking at Devel's query log, you see that the cache_set() query that caches the entire schema contains all 'description' keys for tables and all fields in tables.
The schema cache is loaded on every single request, so it's needlessly larger than it has to be, and unserialize() has lots of additional work to do.
We only ever need the descriptions when installing a schema. Other stuff (like Schema module) can easily cache work around the missing descriptions if it needs to, but that shouldn't slow down regular performance of Drupal core.
Comments
Comment #1
sunNote that #910190: Entire schema cache needlessly loaded on all pages is closely related to this issue. It avoids us from loading the entire schema cache on every page. However, regardless of that, I think that this patch would nevertheless be good to do.
Comment #2
moshe weitzman commentedAgreed. Code looks good. Bot is happy.
Comment #3
sunAlthough my local box is totally not suitable for doing benchmarks, I've mass-applied the following range of current performance patches and am getting a nice boost:
#910190: Entire schema cache needlessly loaded on all pages
#910156: Remove 'description' keys from schema cache
#606966: 'load arguments' of parent path are not inherited
#910124: Clean up menu_contextual_links()
Test page: admin/config/development/devel; Garland; enabled Navigation menu block containing 1 taxonomy term link and 1 node link.
Comment #4
webchickWhy is that parameter called $clean when it is a flag to indicate whether or not to load descriptions? Shouldn't it be $load_descriptions?
Comment #5
sunRenamed $clean to $remove_descriptions as requested.
Comment #7
moshe weitzman commentednice one, bot.
Comment #8
dries commentedAny particular reason why we want to make this configurable? Is there a scenario where we never load the description?
At a minimum, we should consider not loading the descriptions by default. Better to lead with best practices, IMO.
Comment #9
sun@Dries: This is what already happens in the patch. We still need to keep the descriptions when preparing schema for adding new tables or fields. By default, the descriptions are kept. Only the schema cache doesn't need them, so it passes FALSE. That, or I didn't understand your comment. ;)
Comment #10
dries commentedI was suggesting that $remove_descriptions defaults to TRUE.
Comment #11
sunAlright then. Flipped FALSE to TRUE.
Comment #12
moshe weitzman commentedYeah, that’s better.
Comment #13
sun#11: drupal.schema-cache-description.11.patch queued for re-testing.
Comment #14
dries commentedCommitted to CVS HEAD. Thanks.