From 2aad3ce052623742a27825960df803200c4fa5d7 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sat, 17 Apr 2010 12:35:35 +0000 Subject: - Patch #768518 by catch: element_info() should use drupal_static_fast() pattern. --- includes/common.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'includes') 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'); -- cgit v1.2.3