GnuCash
Contact   Instructions
Bug 797945 - Tools -> Import Map Editor causes GnuCash to lock up
Summary: Tools -> Import Map Editor causes GnuCash to lock up
Status: RESOLVED FIXED
Alias: None
Product: GnuCash
Classification: Unclassified
Component: Engine (show other bugs)
Version: 4.1
Hardware: PC Windows
: Normal major
Target Milestone: ---
Assignee: core
QA Contact: core
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-15 22:05 EDT by dan
Modified: 2020-09-17 18:03 EDT (History)
6 users (show)

See Also:


Attachments
(Scrubbed) gnucash repro file (27.82 KB, application/x-gnucash)
2020-09-15 22:05 EDT, dan
no flags Details

Description dan 2020-09-15 22:05:49 EDT
Created attachment 373863 [details]
(Scrubbed) gnucash repro file

Hello. To reproduce the issue, open the attached gnucash file and try to open the Import Map Editor on windows with the latest stable 4.1 build.
Thanks
Comment 1 Bob 2020-09-16 05:46:15 EDT
I have loaded this file and used the Import map editor, it takes about 30 secs to load 4 'CSV Account Maps'

I think this is as a result of the routine to flatten of the import KVP data. The problem is there is no progress indication but this maybe resolved with Chris's progress bar PR, will need to try that.

The other problem is that if the flattening makes no changes then the book property is not set and the flattening process keeps being run.

Will try to have a look at that but I think it was also raised on another BUG.
Comment 2 Christopher Lam 2020-09-17 00:34:17 EDT
@Bob - not yet -- my https://github.com/Gnucash/gnucash/pull/786 is stalled because I wish to augment and expose check_import_map_data as gnc_account_check_import_map_data but not sure how to give it an *optional* callback. Assist would be nice in fixing my C.
Comment 3 John Ralls 2020-09-17 16:09:04 EDT
(In reply to Bob from comment #1)
> I have loaded this file and used the Import map editor, it takes about 30
> secs to load 4 'CSV Account Maps'
> 
> I think this is as a result of the routine to flatten of the import KVP
> data. The problem is there is no progress indication but this maybe resolved
> with Chris's progress bar PR, will need to try that.
> 
> The other problem is that if the flattening makes no changes then the book
> property is not set and the flattening process keeps being run.
> 
> Will try to have a look at that but I think it was also raised on another
> BUG.

One bug that looks like the second problem is bug 797895.
Comment 4 John Ralls 2020-09-17 18:03:47 EDT
Profiling opening the imap editor on repro.gnucash took 96 seconds and showed that most of the time was spent in xaccAccountCommitEdit. Simply moving the check of whether flattened imap vector is empty to before the xaccBeginEdit call and returning if it is makes the process so fast that I can't find check_import_map_data in the profile.

Incidentally, the expensive part of xaccAccountCommitEdit is updating the account page's tree model in gnc_tree_model_account_event_handler. The two hot calls are 
   gnc_tree_mode_account_clear_cached_values
     clear_account_cached_values
       gtk_tree_model_row_changed
and
    propagate_change
       gtk_tree_model_row_changed

We could get a 50% speed up in committing account changes if we could call gtk_tree_model_row_changed only once and a whole lot more if we could figure out how to do it only for the row that actually changed.

Note You need to log in before you can comment on or make changes to this bug.