diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-11-20 06:12:45 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-11-20 06:12:45 +0000 |
commit | b14349889e9e51fb44934694030e95306918e3bd (patch) | |
tree | 68836bca71b2ebb1c5d17b0b20dee9b0aba113ab /includes/module.inc | |
parent | 56e35716bca7569ec796ca5829f7921319abdc51 (diff) | |
download | brdo-b14349889e9e51fb44934694030e95306918e3bd.tar.gz brdo-b14349889e9e51fb44934694030e95306918e3bd.tar.bz2 |
#619666 by effulgentsia, casey, and catch: Changed Introduce new pattern for drupal_static() in performance-critical functions.
Diffstat (limited to 'includes/module.inc')
-rw-r--r-- | includes/module.inc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/includes/module.inc b/includes/module.inc index 8df91dd5c..a3d6c8b45 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -438,7 +438,10 @@ function module_hook($module, $hook) { * @see module_implements_write_cache(). */ function module_implements($hook, $sort = FALSE, $reset = FALSE) { - $implementations = &drupal_static(__FUNCTION__, array()); + // 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__]; // 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 |