Don't fetch theme_roots on every page load.
|Reported by:||ryan||Owned by:|
As part of setting up the directories for the current theme, get_theme_roots() and thus get_site_transient( 'theme_roots' ) is called on every page load. If you have many themes (typical for multisite setups) this means a lot of data is being pulled from the cache. If using a remote cache like memcached all of this data is going over the wire. An active multisite install with many themes and memcached can waste 100s of MBs of bandwidth pulling the same data over and over.
To avoid fetching theme_roots on every page load, lets store the roots for the current stylesheet and template in the options table as template_root and stylesheet_root. If these are present we can avoid calling get_theme_roots() for almost all page loads.