Here's a little more information on the patch I mentioned last night (by Wim Leers):
drupal_lookup_path() optimization - skip looking up certain paths in drupal_lookup_path()
Description
Why?
To reduce the number of queries per page that are completely useless, I've written this optimization.Configuration
You get a new config page at admin/build/path/skiplist to modify the skiplist. The paths listed here can include wildcards as well as '', in the exact same way you can configure on what pages a block should (not) be listed.What has changed to make this work?
The skiplist variable is stored in the 'variable' table
drupal_lookup_path() (in includes/path.inc) has been modified: it uses a mechanism comparable to the one used in block_list(), the regexp part is almost a 1:1 copy of the code in that functionpath.module has been modified, to allow you to configure the skiplist
http://drupal.org/node/106559
Eventually, Khalid came up with a pretty simple and elegant solution - to automatically build a whitelist of acceptable base paths: http://drupal.org/node/106559#comment-1644632
After some feedback and cleanup, it was committed to D7 http://drupal.org/node/106559#comment-1658362
And here's the backport for D6: http://drupal.org/node/106559#comment-1797890
Cheers,
-Chad
