[Kmymoney-devel] Startup is slow

jeffjl.kde at outlook.com jeffjl.kde at outlook.com
Thu Aug 20 15:10:45 UTC 2015

Since I first wrote of this problem, I have changed my baseline.  I am now using emerge version 4.12, mingw, gdb, eclipse (for debug), and KMM version 4.7.2, still on Windows.  (I may not have done that right. I couldn't figure out how to get the current version of emerge to fetch KMM version 4.7.2 and the appropriate Qt/KDE/mingw, so I used an old version of emerge.)
> > at startup, KMyMoney spends literally minutes
> > in the KHomeView::investmentBalance() function.  
I have further narrowed this down to the MyMoneySeqAccessMgr::calculateBalance function calling the transactionList(list,filter) function.  It spends about 2 seconds in each call of transactionList(), and it calls it many thousands of times.

 Just to verify that the root problem is that all my historical trades look "open" to KMM, I added some code to KHomeView::investmentBalance to close the stock if its balance was zero.  Then, when importing the QIF, KMM runs one time for about 20 minutes calculating balances and closing stocks before the home screen updates with balances.  I can save that file and KMM performs reasonably with it from then on.
I'm OK with patching my copy of KMM with that "close the stock" hack just to make my file usable and then removing the hack. I'm not sure what a real fix would be.  It looked like maybe that transacionList() call was doing the same exact thing for every file->balance() call in the for loop in KHomeView::investmentBalance - just filtering by date.  If that's true, filtering once per call to KHomeView::investmentBalance (outside the for loop) instead of once per stock (inside the for loop) would save enormous amounts of time on a file like mine (spending 2 seconds per account instead of 2 seconds per stock).  
>   - "File/File information" showing details about your data. Can you post a 
> screenshot of that information here to let us know something about the number 
> of items in your file? 
I've actually moved on for now and I'm not using my entire Quicken database for debug, so I don't have that info handy.
I'm currently just trying to get one investment account to import properly. It has short sells and cover shorts in it. Handling those looks like a pretty simple change to the QIF reader.  But KMM does not handle trade commissions properly, at least with my QIF from Quicken 2013. And KMM is going to have to allow buying and selling a "stock" for a total cost of zero (i.e. an expired option). So that's where my focus is right now. 
But a fix to the slow filtering would be appreciated.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20150820/20757e70/attachment.html>

More information about the KMyMoney-devel mailing list