I have noticed, that every time comment is being loaded _vud_comment_get_node_type is being called to get node type performing SQL query. If you have 50 comments per page, that's 50 queries, if 300?
I suggest usging static cache as follows in vud_comment.module

 * Function to return the node type of a particular node ID.
function _vud_comment_get_node_type($nid) {
    static $cache = array();
  if (!isset($cache[$nid])) {
      $type = db_result(db_query("SELECT type from {node} where nid = %d", $nid));       
    $cache[$nid] = $type;
        return $type;
    else {
        return $cache[$nid];

6.x-2.x has the same problem.


marvil07’s picture

Status:Active» Fixed
new1.05 KB

OMG, that was bad :-/

I changed a little the code, as the patch attached, and pushed it to 6.x-3.x.


Ainur’s picture

Thanks for the patch. Already using since January.

Status:Fixed» Closed (fixed)

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

mgzrobles’s picture

Issue summary:View changes

same for 7.x version