Speed up first switch to ledgerview
ClosedPublic

Authored by mcherey on Oct 26 2017, 7:27 PM.

Details

Summary

This bug was annoying me for a long time. I use kmymoney for several years and I have about 15k entries (about 5k per one account). Every first switch to ledger view takes ~5s. (package from repo, version 4.6) I was pretty sure that I don't have so much data to process so long. After debugging I saw that problem is in Register::resize that every time goes through all 5k entries for each visible columns and calculating minimal width of column by rendering its text. Register::resize is called about 4 times per first switch (3 times with 'force==true' flag, so guard at the beginning of the function doesn't help us).
So this little optimization makes it possible to call Register::resize as much as you want and it won't affect performance if nothing changed in items.

Diff Detail

Repository
R261 KMyMoney
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
mcherey created this revision.Oct 26 2017, 7:27 PM
tbaumgart accepted this revision as: tbaumgart.Oct 26 2017, 8:14 PM
tbaumgart added a subscriber: tbaumgart.

Looks good to me, even though the 'old register code' will be removed eventually.

This revision is now accepted and ready to land.Oct 26 2017, 8:14 PM
This revision was automatically updated to reflect the committed changes.