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.

Comments

AlexisWilke’s picture

StatusFileSize
new2.05 KB

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

indytechcook’s picture

Status: Needs review » Reviewed & tested by the community

This works great. Setting to RTBC.

tjharman’s picture

Status: Reviewed & tested by the community » Needs work

I have tested this patch. It breaks the ability to edit an individual users tac_lite permissions.

With the patch:

http://xxxxx.com/user//edit/tac_lite

Gives a page not found error.

Without the patch, it works and I can edit permissions.

Anyone else see this?

tjharman’s picture

Status: Needs work » Reviewed & tested by the community

Sorry - I'm a total idiot.
I had the file permissions wrong after patching.
Apologies. Still testing.

liquid06’s picture

Status: Reviewed & tested by the community » Needs work

I am unable to apply the patches in #0 or #1 to the latest -dev release (6.x-1.x-dev June 22, 2010). This issue's version tag is 6.x-1.x dev so I'll paste the patch results I got for that version - just for fun I also tried applying the patches to the latest stable release (right now is 6.x-1.3 March 20, 2009) but I had no luck.

Patch from #0 against 6.x-1.x-dev:

tac_lite$ patch -p0 <tac_lite.module_0.patch 
patching file tac_lite.module
Hunk #1 FAILED at 461.

Patch from #1 against 6.x-1.x-dev:

tac_lite$ patch -p0 <tac_lite-6.x-db_rewrite.patch 
patching file tac_lite.module
Hunk #1 succeeded at 489 (offset 23 lines).
Hunk #2 FAILED at 501.
Hunk #3 FAILED at 518.
AlexisWilke’s picture

liquid06,

It looks like the Jun 22, 2010 1.x-dev version includes my patch in #1.

I will let Dave deal with the status though.

Thank you.
Alexis

achton’s picture

subscribing

nally’s picture

subscribe

Dave Cohen’s picture

Status: Needs work » Fixed
StatusFileSize
new2.22 KB

It's been a while so the patch didn't apply exactly, but I did check in the patch here.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.