Index: includes/cache.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/cache.inc,v
retrieving revision 1.5
diff -u -F^f -r1.5 cache.inc
--- includes/cache.inc	10 Nov 2006 07:26:27 -0000	1.5
+++ includes/cache.inc	29 Nov 2006 01:03:48 -0000
@@ -165,3 +165,39 @@ function cache_clear_all($cid = NULL, $t
   }
 }
 
+/**
+ * Check the current path cache for a an alias.
+ *
+ * @param $path
+ *   The Drupal system path to find the alias for.
+ *
+ * @return
+ *   The alias if it exists in the cache, FALSE otherwise.
+ */
+function drupal_get_path_cache($path) {
+  static $cache;
+
+  if (!isset($cache)) {
+    global $base_root;
+    $cache = cache_get($base_root . request_uri(), 'cache_path');
+    $cache = unserialize($cache->data);
+  }
+
+  if (isset($cache[$path])) {
+    return $cache[$path];
+  }
+
+  return FALSE;
+}
+
+/**
+ * Set the path cache for the current page.
+ */
+function drupal_set_path_cache() {
+  $map = drupal_lookup_path('map');
+  if ($map) {
+    global $base_root;
+    cache_set($base_root . request_uri(), 'cache_path', serialize($map));
+  }
+}
+
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.591
diff -u -F^f -r1.591 common.inc
--- includes/common.inc	28 Nov 2006 07:03:33 -0000	1.591
+++ includes/common.inc	29 Nov 2006 01:03:50 -0000
@@ -1249,6 +1249,7 @@ function drupal_page_footer() {
   if (variable_get('cache', 0)) {
     page_set_cache();
   }
+  drupal_set_path_cache();
 
   module_invoke_all('exit');
 }
Index: includes/path.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/path.inc,v
retrieving revision 1.11
diff -u -F^f -r1.11 path.inc
--- includes/path.inc	26 Nov 2006 01:55:37 -0000	1.11
+++ includes/path.inc	29 Nov 2006 01:03:50 -0000
@@ -32,6 +32,7 @@ function drupal_init_path() {
  *   - wipe: delete the alias cache.
  *   - alias: return an alias for a given Drupal system path (if one exists).
  *   - source: return the Drupal system URL for a path alias (if one exists).
+ *   - map: return the map of the aliases for Drupal system paths recorded thus far.
  * @param $path
  *   The path to investigate for corresponding aliases or system URLs.
  *
@@ -53,11 +54,22 @@ function drupal_lookup_path($action, $pa
     $map = array();
     $no_src = array();
   }
+  elseif ($action == 'map') {
+    return $map;
+  }
   elseif ($count > 0 && $path != '') {
     if ($action == 'alias') {
-      if (isset($map[$path]) || array_key_exists($path, $map)) {
+      if (isset($map[$path])) {
         return $map[$path];
       }
+
+      $alias = drupal_get_path_cache($path);
+      $map[$path] = $alias;
+
+      if (isset($alias)) {
+        return $alias;
+      }
+
       $alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s'", $path));
       $map[$path] = $alias;
       return $alias;
