Hello.
Now our team works on the project that is built on Drupal 5.3 with many modules plugged in and has a lot of content.
A lot of functionality is already implemented and now I'm researching performance problem.
Number of queries is a real problem.
I implemented some caching for several modules but number of queries still to high.
I'm using devel module for researching.
I found that drupal_lookup_path executed very often so I wrote some enhancement for this Drupal core function.
Drupal code (in includes/path.inc):
if ($action == 'alias') {
if (isset($map[$path])) {
return $map[$path];
}
$alias = db_result(db_query("SELECT dst FROM {url_alias} WHERE src = '%s'", $path));
$map[$path] = $alias;
return $alias;
}
with my changes:
// in the static variables definition part
static $searched = array();
if ($action == 'alias') {
if (isset($map[$path])) return $map[$path];
$last_symbol = substr($path, -1, 1);
if ($last_symbol >= '0' && $last_symbol <= '9') {
$path_mask = substr($path, 0, -1);
if (!isset($searched[$path_mask])) {
$searched[$path_mask] = true;
$result = db_query("SELECT src, dst FROM {url_alias} WHERE src LIKE '%s_' LIMIT 10", substr($path, 0, -1));