diff options
-rw-r--r-- | includes/common.inc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/includes/common.inc b/includes/common.inc index b3497d0d9..312246d77 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -5291,7 +5291,12 @@ function element_sort($a, $b) { * Retrieve the default properties for the defined element type. */ function element_info($type) { - $cache = &drupal_static(__FUNCTION__); + // Use the advanced drupal_static() pattern, since this is called very often. + static $drupal_static_fast; + if (!isset($drupal_static_fast)) { + $drupal_static_fast['cache'] = &drupal_static(__FUNCTION__); + } + $cache = &$drupal_static_fast['cache']; if (!isset($cache)) { $cache = module_invoke_all('element_info'); |