khal icon indicating copy to clipboard operation
khal copied to clipboard

ikhal is really slow

Open grsubramanian opened this issue 5 years ago • 2 comments

Generally speaking, the concept behind khal is awesome. I got it to work fine with my google calendar. That calendar has only few items, and ikhal's navigation is seamless.

However, I am also trying to use this for my office calendar at work, where I have tons of meeting events (total ~300 ics files, totaling ~5MB in vdir). In this setup, the same ikhal installation is very slow (~5 seconds) both to startup and to navigate in the calendar view (hangs a lot).

I am using a MacOSX (Darwin Kernel Version 16.7.0), Python 3.7.0, khal 0.9.9 based on pip3 install (global installation without virtualenv).

I tried the simple non-pkg_resources variant

#!/usr/bin/env python3

from khal.cli import main_khal

main_khal()

but that did not change anything noticeable.

I profiled khal with the default invocation and got khal.profile.tar.gz based on python3 cProfile which I cannot fully understand since I don't know all the function names. But it seems like a lot of time is being spent in parser.py. Pardon me if I am mistaken.

Could you please help me out.

grsubramanian avatar Oct 02 '18 22:10 grsubramanian

You are right, khal takes a ridiculous amount of time there and yes, most of it is spent on parsing some icalendar files. How many events does khal show on the default run? Something in the order of ~100 entries shouldn't really be a problem. I suspect something is either wrong with your icalendar installation or you have some weird .ics files.

Which version of icalendar do you have installed (pip freeze)?

geier avatar Feb 12 '19 22:02 geier

On my system, khal executes in ~ 1.1sec with

timedelta = 1d

and ~1.5sec with

timedelta = 4d

Now, ikhal takes roughly same amount as for OP (~5s); to me it's clear that ics parsing is an obvious candidate. Could it be done lazily to improve the responsiveness of the program?

laur89 avatar Oct 02 '19 15:10 laur89