From 4fc61b2ac887dd676c9e44514d07b59db25031eb Mon Sep 17 00:00:00 2001 From: John Ralls Date: Sat, 19 Aug 2017 20:25:57 +0200 Subject: [PATCH] Commit imap conversions once per account instead of per import map slot. Commits are expensive in the SQL backend; this resulted in a >40x speedup in loading a database with 3400 import map slots (>2 hours to 3 minutes). --- libgnucash/engine/Account.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgnucash/engine/Account.c b/libgnucash/engine/Account.c index b2dd9871e6..1daab9ee51 100644 --- a/libgnucash/engine/Account.c +++ b/libgnucash/engine/Account.c @@ -5928,7 +5928,7 @@ convert_imap_account (Account *acc) if (g_list_length (imap_list) > 0) // we have mappings { PINFO("List length is %d", g_list_length (imap_list)); - + xaccAccountBeginEdit(acc); for (node = imap_list; node; node = g_list_next (node)) { Account *map_account = NULL; @@ -5939,7 +5939,6 @@ convert_imap_account (Account *acc) if (map_account != NULL) // we have an account, try and update it convert_imap_entry (imapInfo, map_account); - // Free the members and structure g_free (imapInfo->category_head); g_free (imapInfo->full_category); @@ -5947,6 +5946,7 @@ convert_imap_account (Account *acc) g_free (imapInfo->count); g_free (imapInfo); } + xaccAccountCommitEdit(acc); } g_free (acc_name); g_list_free (imap_list); // Free the List