Reviewing how this module works I noticed a rather large amount of calls that cause a SELECT query on the troll_ip_track table.
This IP is then injected into the $comment Object and never used anywhere else in the module.

The issue is that this happens for every comment view, so on a Forum site with say 50 comments being shown that is 50 extra queries for no reason.
I am assuming there was an intent to provide some kind of interface, or at the very least provide the data for it to be used in a template file.

If this is the case then there needs to be a conditional wrapper around the call so that it only fires for people who have the permission to manage the troll features.
Otherwise all page views for anonymous and normal authenticated users will be adding those extra queries for no reason.

This has shown up as 300-800ms extra per page to execute those queries.

Comments

bibo’s picture

I would love to see everything unnecessary removed.. does this really add 300-800ms extra on your site? I looked in new relic and this select query seemed to be around 0.75ms on average. So to get to 750ms extra, I would need to see it 1000x on one pageload. Our mysql is a very big instance though, and we have tens of millions of comments.

codexmas’s picture

Indeed, I no longer have the New Relic traces showing that though.
Regardless of the performance impact the function attaches an extra query per comment being viewed for every user to grab data that is never used.
Thanks for following up!