[Kmymoney-devel] Review Request 118107: Calculate cleared balance in core

Alvaro Soliverez asoliverez at kde.org
Tue May 13 20:47:57 UTC 2014



> On May 12, 2014, 11:08 p.m., Marko Käning wrote:
> > I'll incorporate it as soon as possible in a updated version of https://git.reviewboard.kde.org/r/112885/ .
> > 
> > Thanks, Alvaro, for doing this job.
> > 
> > I'll also report back as soon as I can regarding speed.
> 
> Marko Käning wrote:
>     Only now I realise that you did not cache the value in any case which lets you re-iterate through all transactions at every call...
>     
>     Wasn't there some caching built-in for the corresponding MyMoneyFile::balance()?
> 
> Marko Käning wrote:
>     Alvaro, I successfully incorporated your patch using git master and ran my actual kmy with it.
>     
>     My account with the most transactions didn't show any significant change of speed (although there's seemingly no caching up to now - but perhaps I am mistaken there?).
>     
>     This was measured manually as the time lag until the corresponding ledger appears after clicking the ledger icon - i.e. not applying any debug output - which resulted in a duration of about 1.5s.
> 
> Alvaro Soliverez wrote:
>     TBH, at first I thought this feature was only used during reconciliation and not every time the ledger is loaded. 
>     In any case, there are still some optimizations to be made (eg. caching, calculating the cleared balance with a different method if the account was never reconciled, etc.), but it only makes sense to optimize once a problem has been detected.
> 
> Christian David wrote:
>     "it only makes sense to optimize once a problem has been detected" +1
>     
>     I tried this patch with a huge xml test file (about 100 000 transactions and 50 000 per account). By hand I could not find a difference in speed. This makes sense, as the main problem is probably loading and copying the data to and within main memory. Compared to that just reading it to calculate a sum should be negligible.
> 
> Marko Käning wrote:
>     You are right. Let's ship it.

There's also one fundamental difference with the balance() method. That one needs a cache because the AccountsModel calls it every time a transaction is updated for all accounts. This is only needed for one particular account when the ledger is displayed.


- Alvaro


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/118107/#review57833
-----------------------------------------------------------


On May 12, 2014, 10:53 p.m., Alvaro Soliverez wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/118107/
> -----------------------------------------------------------
> 
> (Updated May 12, 2014, 10:53 p.m.)
> 
> 
> Review request for KMymoney.
> 
> 
> Repository: kmymoney
> 
> 
> Description
> -------
> 
> It calculates cleared balance for an account in MyMoneyFile, instead of doing it in the ledger view (kgloballedgerview.cpp)
> 
> I'm posting it here because I'm a bit concerned on the performance it may have for everyday use.
> I'm keen on optimizing, but this kind of code should be removed from the views in the long-term.
> 
> 
> Diffs
> -----
> 
>   kmymoney/mymoney/mymoneyfile.h 3a39ba0 
>   kmymoney/mymoney/mymoneyfile.cpp 4f6d277 
>   kmymoney/views/kgloballedgerview.cpp d2d626c 
> 
> Diff: https://git.reviewboard.kde.org/r/118107/diff/
> 
> 
> Testing
> -------
> 
> I tested with a small file. It works ok. I still have to add a unit test for it.
> 
> 
> Thanks,
> 
> Alvaro Soliverez
> 
>

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


More information about the KMyMoney-devel mailing list