summaryrefslogtreecommitdiff
path: root/includes/module.inc
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-07 04:54:18 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-01-07 04:54:18 +0000
commit3ede61995539d7f4b1ee0b7f30897b849400f490 (patch)
treeecfb961c8e28ce0edfac5e050276928a94f17993 /includes/module.inc
parent37fcdbc67cd5591107c93016d1d3bb109be5e9e6 (diff)
downloadbrdo-3ede61995539d7f4b1ee0b7f30897b849400f490.tar.gz
brdo-3ede61995539d7f4b1ee0b7f30897b849400f490.tar.bz2
#619666 follow-up by effulgentsia: Make performance-critical usage of drupal_static() grokkable.
Diffstat (limited to 'includes/module.inc')
-rw-r--r--includes/module.inc8
1 files changed, 5 insertions, 3 deletions
diff --git a/includes/module.inc b/includes/module.inc
index e3f31a009..f440858a8 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -450,9 +450,11 @@ function module_hook($module, $hook) {
*/
function module_implements($hook, $sort = FALSE, $reset = FALSE) {
// Use the advanced drupal_static() pattern, since this is called very often.
- static $drupal_static = array();
- isset($drupal_static[__FUNCTION__]) || ($drupal_static[__FUNCTION__] = &drupal_static(__FUNCTION__));
- $implementations = &$drupal_static[__FUNCTION__];
+ static $drupal_static_fast;
+ if (!isset($drupal_static_fast)) {
+ $drupal_static_fast['implementations'] = &drupal_static(__FUNCTION__);
+ }
+ $implementations = &$drupal_static_fast['implementations'];
// We maintain a persistent cache of hook implementations in addition to the
// static cache to avoid looping through every module and every hook on each