tac_lite_db_rewrite_sql() inefficiency

jweowu - May 13, 2009 - 05:11
Project:Taxonomy Access Control Lite
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

tac_lite_db_rewrite_sql() does a bunch of work every time it's called, regardless of the query's primary field.

I've attached a patch which moves that code inside the 'tid' case for the primary field switch statement.

I haven't tested this, as I might not be using the module after all; but I'd noticed the issue while I was looking at it.

AttachmentSize
tac_lite.module.patch2.47 KB

#1

AlexisWilke - June 14, 2009 - 08:26

Dave,

Got to agree with jweowu! The db rewrite function is not well optimized.

I have a better patch which makes it even faster. For instance, I exit the function immediately when the field isn't 'tid'. And the loop used a variable_get() which I replaced with a $max variable. That's got to be a lot better if you have "many" schemes.

Thank you.
Alexis Wilke

AttachmentSize
tac_lite-6.x-db_rewrite.patch 2.05 KB
 
 

Drupal is a registered trademark of Dries Buytaert.