=== modified file 'includes/path.inc'
--- includes/path.inc	2009-01-04 20:04:32 +0000
+++ includes/path.inc	2009-02-21 16:59:47 +0000
@@ -46,13 +46,15 @@ function drupal_init_path() {
 function drupal_lookup_path($action, $path = '', $path_language = '') {
   global $language;
   // $map is an array with language keys, holding arrays of Drupal paths to alias relations
-  static $map = array(), $no_src = array(), $count;
+  static $map = array(), $no_src = array(), $enabled;
 
   $path_language = $path_language ? $path_language : $language->language;
 
-  // Use $count to avoid looking up paths in subsequent calls if there simply are no aliases
-  if (!isset($count)) {
-    $count = db_query('SELECT COUNT(pid) FROM {url_alias}')->fetchField();
+  // Avoid looking up paths in subsequent calls if path.module is not enabled.
+  // We can not rely on module_exists because path is bootstrapped before
+  // modules are loaded.
+  if (!isset($enabled)) {
+    $enabled = variable_get('path_enabled', FALSE);
   }
 
   if ($action == 'wipe') {

=== modified file 'modules/path/path.info'
--- modules/path/path.info	2008-10-11 02:32:32 +0000
+++ modules/path/path.info	2009-02-21 17:00:05 +0000
@@ -6,3 +6,4 @@ version = VERSION
 core = 7.x
 files[] = path.module
 files[] = path.admin.inc
+files[] = path.install

=== added file 'modules/path/path.install'
--- modules/path/path.install	1970-01-01 00:00:00 +0000
+++ modules/path/path.install	2009-02-21 16:59:05 +0000
@@ -0,0 +1,17 @@
+<?php
+
+// $Id$
+
+/**
+ * Implementation of hook_enable.
+ */
+function path_enable() {
+  variable_set('path_enable', TRUE);
+}
+
+/**
+ * Implementation of hook_disable.
+ */
+function path_disable() {
+  variable_det('path_enable');
+}

