[Gnucash-changes] IMPORTANT Patch for performance; please test and port to g2 branch.

Linas Vepstas linas at cvs.gnucash.org
Sun May 30 15:32:00 EDT 2004


Log Message:
-----------
IMPORTANT Patch for performance; please test and port to g2 branch.
This patch fixes some, not all, of the problems discussed in 
http://bugzilla.gnome.org/show_bug.cgi?id=120028

The performance problem occurs when there are large numbers of 
accounts in the account tree (for example 600 or more).  This patch
fixes performance problems with transaction editing and register 
updates.

There are four calls to gnc_load_xfer_cell(), which is called twice by
gnc_split_register_load_xfer_cells() which is called by
gnc_split_register_load() in register/ledger-core/split-register-load.c
These calls should have been protected by if (info->first_pass)
so that they'd be called only when the register is first opened,
instead of each transaction update.  I just moved these to
a more correct location in that routine, and surrounded by
the fisrt_pass test, and it seems to make a huge difference in
performance, and it seems to still work correctly.

Modified Files:
--------------
    gnucash/src/register/ledger-core:
        split-register-load.c

Revision Data
-------------
Index: split-register-load.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/register/ledger-core/split-register-load.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -Lsrc/register/ledger-core/split-register-load.c -Lsrc/register/ledger-core/split-register-load.c -u -r1.25 -r1.26
--- src/register/ledger-core/split-register-load.c
+++ src/register/ledger-core/split-register-load.c
@@ -276,6 +276,7 @@
 
   /* get the current time and reset the dividing row */
   present = gnc_timet_get_today_end ();
+
   if (info->first_pass)
   {
     if (default_account)
@@ -292,6 +293,28 @@
         has_last_num = TRUE;
       }
     }
+
+    /* set the completion character for the xfer cells */
+    gnc_combo_cell_set_complete_char
+      ((ComboCell *)
+       gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL),
+       gnc_get_account_separator ());
+  
+    gnc_combo_cell_set_complete_char
+      ((ComboCell *)
+       gnc_table_layout_get_cell (reg->table->layout, XFRM_CELL),
+       gnc_get_account_separator ());
+  
+    /* set the confirmation callback for the reconcile cell */
+    gnc_recn_cell_set_confirm_cb
+      ((RecnCell *)
+       gnc_table_layout_get_cell (reg->table->layout, RECN_CELL),
+       gnc_split_register_recn_cell_confirm, reg);
+  
+    /* load up account names into the transfer combobox menus */
+    gnc_split_register_load_xfer_cells (reg, default_account);
+    gnc_split_register_load_recn_cells (reg);
+    gnc_split_register_load_type_cells (reg);
   }
 
   table->model->dividing_row = -1;
@@ -512,29 +535,8 @@
 
   gnc_split_register_show_trans (reg, table->current_cursor_loc.vcell_loc);
 
-  /* set the completion character for the xfer cells */
-  gnc_combo_cell_set_complete_char
-    ((ComboCell *)
-     gnc_table_layout_get_cell (reg->table->layout, MXFRM_CELL),
-     gnc_get_account_separator ());
-
-  gnc_combo_cell_set_complete_char
-    ((ComboCell *)
-     gnc_table_layout_get_cell (reg->table->layout, XFRM_CELL),
-     gnc_get_account_separator ());
-
-  /* set the confirmation callback for the reconcile cell */
-  gnc_recn_cell_set_confirm_cb
-    ((RecnCell *)
-     gnc_table_layout_get_cell (reg->table->layout, RECN_CELL),
-     gnc_split_register_recn_cell_confirm, reg);
-
   /* enable callback for cursor user-driven moves */
   gnc_table_control_allow_move (table->control, TRUE);
-
-  gnc_split_register_load_xfer_cells (reg, default_account);
-  gnc_split_register_load_recn_cells (reg);
-  gnc_split_register_load_type_cells (reg);
 }
 
 static void


More information about the gnucash-changes mailing list