The performance of purl_modifiers() can be significantly improved, in particular for implementations where providers set null_id = TRUE and the {purl} table contains a large number of values.

Comments

pdrake’s picture

In my particular use-case (large number of values in the {purl} table, one provider with null_id = TRUE), the attached patch improves performance by somewhere between 0.5s and 3.0s depending on the page.

pdrake’s picture

Status: Active » Needs review
pdrake’s picture

This patch applies to the latest stable release (6.x-1.0-beta13) for anyone who may be using that version but can otherwise be ignored. The patch for 6.x-1.x-dev is #1.

glennpratt’s picture

Status: Needs review » Reviewed & tested by the community

Diff looks good and is running fine in production on a site using purl_prefix and spaces_og.

dbehrman’s picture

Updated patch:
$result = db_query("SELECT id, value FROM {purl} WHERE provider = %s", $provider);
should be
$result = db_query('SELECT id, value FROM {purl} WHERE provider = "%s"', $provider);