diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 01ae311..d47686a 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -676,7 +676,11 @@ function page_get_cache($status_only = FALSE) {
  *   The name of the bootstrap hook we wish to invoke.
  */
 function bootstrap_invoke_all($hook) {
-  foreach (module_list(TRUE, TRUE) as $module) {
+  static $bootstrap_modules;
+  if (!isset($bootstrap_modules)) {
+    $bootstrap_modules = module_list(TRUE, TRUE);
+  }
+  foreach ($bootstrap_modules as $module) {
     drupal_load('module', $module);
     module_invoke($module, $hook);
   }
