r17001 - gnucash/trunk/lib/libqof/qof - Improve performance of qof_query_invert().

Andreas Köhler andi5 at cvs.gnucash.org
Sun Mar 2 17:12:00 EST 2008


Author: andi5
Date: 2008-03-02 17:12:00 -0500 (Sun, 02 Mar 2008)
New Revision: 17001
Trac: http://svn.gnucash.org/trac/changeset/17001

Modified:
   gnucash/trunk/lib/libqof/qof/qofquery.c
Log:
Improve performance of qof_query_invert().

Prepend terms and reverse once at the end instead of "reverse, prepend,
reverse" for each term.


Modified: gnucash/trunk/lib/libqof/qof/qofquery.c
===================================================================
--- gnucash/trunk/lib/libqof/qof/qofquery.c	2008-03-02 20:59:29 UTC (rev 17000)
+++ gnucash/trunk/lib/libqof/qof/qofquery.c	2008-03-02 22:12:00 UTC (rev 17001)
@@ -1022,14 +1022,9 @@
       qt = copy_query_term(cur->data);
       qt->invert = !(qt->invert);
       new_oterm = g_list_append(NULL, qt);
-
-      /* g_list_append() can take forever, so let's do this for speed
-       * in "large" queries.
-       */
-      retval->terms = g_list_reverse(retval->terms);
       retval->terms = g_list_prepend(retval->terms, new_oterm);
-      retval->terms = g_list_reverse(retval->terms);
     }
+    retval->terms = g_list_reverse(retval->terms);
     break;
 
     /* If there are multiple OR-terms, we just recurse by 



More information about the gnucash-changes mailing list