[Kmymoney-devel] Startup is slow

jeffjl.kde at outlook.com jeffjl.kde at outlook.com
Sat Aug 22 05:05:52 UTC 2015


 
> On Sat, 22 Aug 2015 00:38:06 -0300, asoliverez at kde.org wrote
> Hello Jeff,
> Could you provide a version of that file in anonymous format (Save As -> 
> Anonymous file), so that we could run some tests and find a possible 
> fix?
> 
> There's a cache for balances, so it shouldn't call transactionList 
> twice, thus I'm very interested to know why this happens in this case.
> 
I don't think a balance cache would help because KMM is determining, at QIF import for the first time, the balance on each of thousands of stocks.  That's thousands of individual balances it has to calculate.  And for each balance it has to search through even more thousands of transactions looking for buys/sells of that particular stock to figure the balance for that particular stock.  (But I don't think the search is the time consumer. The slow part is that date filter that comes up with the transactions to search. And it does that once per stock.) Once it has done that, a balance cache would help. At least, that's my understanding of what it is doing. Is the balance cache is saved in the file? It might be that KMM starts up faster once I save the file after doing the QIF import. I can't remember. I think it is still slow.  Since I'm having issues with data integrity through the QIF import, I don't often save the file. If I misunderstand and you still need my file, I can do that. It would take me (actually KMM) a while to make it, and it will be quite big. I'm not working with the full file right now. But even this subset file is a little slow. Maybe it would work for your test. And I could make it quickly.  But if it's the QIF import making the stocks and transactions "new" that's important, the KMM file won't help either. Let me know what I can do to help. Thanks,Jeff.  
> 
> 
> On 2015-08-20 12:10, jeffjl.kde at outlook.com wrote:
> > 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.
> > 
> > 
> > _______________________________________________
> > KMyMoney-devel mailing list
> > KMyMoney-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/kmymoney-devel
> 
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kmymoney-devel/attachments/20150822/b10e33f5/attachment.html>


More information about the KMyMoney-devel mailing list