Bug 251127 - Korganizer slow when using regional holidays setting
Summary: Korganizer slow when using regional holidays setting
Status: RESOLVED FIXED
Alias: None
Product: kdepimlibs
Classification: Applications
Component: kholidays (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: John Layt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-13 17:58 UTC by G. Landini
Modified: 2010-12-02 00:03 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description G. Landini 2010-09-13 17:58:30 UTC
Version:           unspecified (using KDE 4.4.6) 
OS:                Linux

This is happening in version 4.4.6 of Korganizer.
It is nearly unusable when one uses the regional holidays setting (here I am using UK).

Reproducible: Always

Steps to Reproduce:
Configure> Time and Date> Use holiday region> United Kingdom

Actual Results:  
Korganizer becomes slow in responding to any clicking or changing days


OS: Linux (x86_64) release 2.6.34.4-0.1-desktop
Compiler: gcc
Comment 1 G. Landini 2010-09-13 22:21:38 UTC
I can confirm that this happens in the 32 as well as in the 64bit versions.
Comment 2 John Layt 2010-09-14 12:22:31 UTC
Is this when using a 4.5 version of KDE and kdepimlibs but still with kdepim 4.4?

If so then its because kholidays recalculates all the holidays each time it is called, there's no caching of results, and the new calculator in 4.5 is less efficient.  As found in other apps it is usually because multiple calls are being made to the holidays() method using just a single date each time, resulting in repeated recalculations for the displayed date range.  

The interim solution is to use the new holidays() method that takes a date range and returns all the holidays, resulting in only a single calculation rather than 30-40.  I'll have a look if there's any easy fixes here.

In 4.6 I'll be adding shared caching of the calculated results which should resolve the issue fully.
Comment 3 G. Landini 2010-09-14 12:50:29 UTC
Hi John, 
Yes, this seems to be the case. The libraries I have installed at the moment are:
kdepimlibs4 4.5.1-176.1
libkdepim4 4.4.6-239.1
libkdepimlibs4 4.5.1-176.1

I hope that I did not install anything I shouldn't have. (actually these were all installed via yast automatically when I switched to the Factory repo of opensuse.
Thanks for looking into this.
Regards

Gabriel
Comment 4 John Layt 2010-09-14 14:31:55 UTC
OK, that probably confirms it then.  You've done nothing wrong, it's supposed to work OK that way.

I've looked through all the uses of holidays() in KOrganizer and fixing it could be a little more invasive than I would like for a bugfix release, but the alternative of adding caching to KHolidays in a bugfix release is worse.  I'll try code some fixes and run them past the kdepim reviewboard to see what people think.
Comment 5 Sergio Martins 2010-09-14 19:08:04 UTC
I made some fixes in 4.5, and even more fixes in trunk. Didn't backport anything to 4.4 though.
Comment 6 John Layt 2010-09-15 16:09:15 UTC
I've prepared some fixes in the 4.5 branch to KODayMatrix, KOAgendaView, MonthView and ActionManager which should help.  I forgot to test the response times in 4.5 before the changes, but it was snappy afterwards.  However backporting to 4.4 conditional on KDEPIMLIB_VERSION didn't completely resolve the delays so the Working Days code is probably still an issue there and I don't see an easy/clean way to patch that.  

Instead I've gone back to trying to improve KHolidays performance by implementing an optimisation to only parse the file for the calendar systems actually used in the file, reducing most calls to only parsing the file once instead of 11 times.  Testing with the kdepim 4.4 and kdepimlibs combination the response is snappy again so I'm hopeful this will resolve the issue.  The fix will be in the 4.5.2 release scheduled for 2010-10-05.

I'll post the 4.5 patches to ReviewBoard for comments anyway, then look at trunk to see if the patches are appropriate there.
Comment 7 John Layt 2010-09-15 16:13:50 UTC
SVN commit 1175669 by jlayt:

Improve efficiency of KHolidays by only parsing for required calendar systems.

Backport of r1175645

CCBUG: 251127



 M  +23 -18    holidayparserdriverplan.cpp  
 M  +4 -0      holidayparserdriverplan_p.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1175669
Comment 8 John Layt 2010-09-16 22:27:56 UTC
SVN commit 1176162 by jlayt:

Performance improvements to KOrganizer, use more efficient KHolidays calls

See http://reviewboard.kde.org/r/5343/

CCBUG: 251127


 M  +6 -11     actionmanager.cpp  
 M  +12 -2     kodaymatrix.cpp  
 M  +11 -1     views/agendaview/koagendaview.cpp  
 M  +11 -1     views/monthview/monthview.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1176162
Comment 9 G. Landini 2010-12-01 22:58:09 UTC
I have installed KDE 4.6 pre and the problem seems to have been solved. 
Many thanks!
Comment 10 John Layt 2010-12-02 00:03:06 UTC
Thanks!