r18724 - gnucash/trunk/src/backend/sql - When creating lists of database objects, use g_list_prepend() rather than g_list_append(). There may be cases where the list order is significant and thus needs to be reversed, but that is not true in these cases. This provides a large improvement in database loading performance.
Phil Longstaff
plongstaff at code.gnucash.org
Wed Feb 24 15:11:22 EST 2010
Author: plongstaff
Date: 2010-02-24 15:11:22 -0500 (Wed, 24 Feb 2010)
New Revision: 18724
Trac: http://svn.gnucash.org/trac/changeset/18724
Modified:
gnucash/trunk/src/backend/sql/gnc-budget-sql.c
gnucash/trunk/src/backend/sql/gnc-schedxaction-sql.c
gnucash/trunk/src/backend/sql/gnc-transaction-sql.c
Log:
When creating lists of database objects, use g_list_prepend() rather than g_list_append(). There may be cases where the list order is significant and thus needs to be reversed, but that is not true in these cases. This provides a large improvement in database loading performance.
Analysis and basis patch supplied by Donald Allen.
Modified: gnucash/trunk/src/backend/sql/gnc-budget-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-budget-sql.c 2010-02-24 19:53:37 UTC (rev 18723)
+++ gnucash/trunk/src/backend/sql/gnc-budget-sql.c 2010-02-24 20:11:22 UTC (rev 18724)
@@ -331,7 +331,7 @@
while( row != NULL ) {
b = load_single_budget( be, row );
if( b != NULL ) {
- list = g_list_append( list, b );
+ list = g_list_prepend( list, b );
}
row = gnc_sql_result_get_next_row( result );
}
Modified: gnucash/trunk/src/backend/sql/gnc-schedxaction-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-schedxaction-sql.c 2010-02-24 19:53:37 UTC (rev 18723)
+++ gnucash/trunk/src/backend/sql/gnc-schedxaction-sql.c 2010-02-24 20:11:22 UTC (rev 18724)
@@ -245,7 +245,7 @@
sx = load_single_sx( be, row );
if( sx != NULL ) {
gnc_sxes_add_sx( sxes, sx );
- list = g_list_append( list, sx );
+ list = g_list_prepend( list, sx );
}
row = gnc_sql_result_get_next_row( result );
}
Modified: gnucash/trunk/src/backend/sql/gnc-transaction-sql.c
===================================================================
--- gnucash/trunk/src/backend/sql/gnc-transaction-sql.c 2010-02-24 19:53:37 UTC (rev 18723)
+++ gnucash/trunk/src/backend/sql/gnc-transaction-sql.c 2010-02-24 20:11:22 UTC (rev 18724)
@@ -235,7 +235,7 @@
Split* s;
s = load_single_split( be, row );
if( s != NULL ) {
- split_list = g_list_append( split_list, s );
+ split_list = g_list_prepend( split_list, s );
}
row = gnc_sql_result_get_next_row( result );
}
@@ -382,7 +382,7 @@
while( row != NULL ) {
tx = load_single_tx( be, row );
if( tx != NULL ) {
- tx_list = g_list_append( tx_list, tx );
+ tx_list = g_list_prepend( tx_list, tx );
}
row = gnc_sql_result_get_next_row( result );
}
More information about the gnucash-changes
mailing list