Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.209
diff -u -r1.209 bootstrap.inc
--- includes/bootstrap.inc	6 May 2008 12:18:45 -0000	1.209
+++ includes/bootstrap.inc	9 May 2008 12:30:25 -0000
@@ -519,7 +519,6 @@
  */
 function bootstrap_invoke_all($hook) {
   foreach (module_list(TRUE, TRUE) as $module) {
-    drupal_load('module', $module);
     module_invoke($module, $hook);
   }
 }
@@ -1003,6 +1002,9 @@
       require_once './includes/path.inc';
       // Initialize $_GET['q'] prior to loading modules and invoking hook_init().
       drupal_init_path();
+
+      // Load files for this path from the registry cache.
+      registry_load_path_files();
       break;
 
     case DRUPAL_BOOTSTRAP_FULL:
@@ -1285,7 +1287,9 @@
   }
 
   if ($write_to_persistent_cache === TRUE) {
-    cache_set('hooks', $implementations, 'cache_registry');
+    if ($implementations != registry_get_hook_implementations_cache()) {
+      cache_set('hooks', $implementations, 'cache_registry');
+    }
   }
 }
 
@@ -1293,6 +1297,7 @@
  * Save the files required by the registry for this path.
  */
 function registry_cache_path_files() {
+  global $user;
   if ($used_code = registry_mark_code(NULL, NULL, TRUE)) {
     $files = array();
     $type_sql = array();
@@ -1307,12 +1312,53 @@
       $files[] = $row->filename;
     }
     if ($files) {
-      $menu = menu_get_item();
-      cache_set('registry:' . $menu['path'], implode(';', $files), 'cache_registry');
+      sort($files);
+      if ($files != registry_load_path_files(TRUE)) {
+        $cache_id = 'registry_' . ($user->uid ? 'logged_in:' : 'anon:') . $_GET['q'];
+        cache_set($cache_id, implode(';', $files), 'cache_registry');
+      }
+    }
+  }
+}
+
+
+/**
+ * registry_load_path_files 
+ */
+function registry_load_path_files($return = FALSE) {
+  global $user;
+  static $file_cache_data;
+  if ($return) {
+    return $file_cache_data;
+  }
+  $cache_id = 'registry_' . ($user->uid ? 'logged_in:' : 'anon:') . $_GET['q'];
+  $cache = cache_get($cache_id, 'cache_registry');
+  if (!empty($cache->data)) {
+    foreach(explode(';', $cache->data) as $file) {
+      require_once($file);
+      $file_cache_data[] = $file;
     }
+    sort($file_cache_data);
   }
 }
 
 /**
+ * registry_get_hook_implementations_cache 
+ */
+function registry_get_hook_implementations_cache() {
+  static $implementations;
+  if ($implementations === NULL) {
+    if ($cache = cache_get('hooks', 'cache_registry')) {
+      $implementations = $cache->data;
+    }
+    else {
+      $implementations = array();
+    }
+  }
+  return $implementations;
+}
+
+/**
  * @} End of "ingroup registry".
  */
+
Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.271
diff -u -r1.271 menu.inc
--- includes/menu.inc	6 May 2008 12:18:45 -0000	1.271
+++ includes/menu.inc	9 May 2008 12:30:31 -0000
@@ -339,12 +339,6 @@
     menu_rebuild();
   }
   if ($router_item = menu_get_item($path)) {
-    $cache = cache_get('registry:' . $router_item['path'], 'cache_registry');
-    if (!empty($cache->data)) {
-      foreach(explode(';', $cache->data) as $file) {
-        require_once($file);
-      }
-    }
     if ($router_item['access']) {
       if (drupal_function_exists($router_item['page_callback'])) {
         return call_user_func_array($router_item['page_callback'], $router_item['page_arguments']);
Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.119
diff -u -r1.119 module.inc
--- includes/module.inc	7 May 2008 06:39:57 -0000	1.119
+++ includes/module.inc	9 May 2008 12:30:32 -0000
@@ -408,9 +408,7 @@
     $implementations = array();
   }
   else if (!defined('MAINTENANCE_MODE') && empty($implementations)) {
-    if ($cache = cache_get('hooks', 'cache_registry')) {
-      $implementations = $cache->data;
-    }
+    $implementations = registry_get_hook_implementations_cache();
   }
 
   if (!isset($implementations[$hook])) {
