[Kst] Adding lots of curves through KstScript is slow

Andrew Walker arwalker at sumusltd.com
Thu Jan 28 02:05:17 CET 2010


Hi Michael,

My changes have the same effect as your patch, as long as the user puts the 
necessary enableRepaints in their script.

There are circumstances under which a repaint won't happen immediately after 
adding a curve or other object,
such as when the update rate on Kst is set to a large value, so for the 
typical user the calls to paintAll do provide some benefit.

The advantage of the code already checked in is that it won't change the 
current behaviour for other scripts already in existence.

Andrew

----- Original Message ----- 
From: <bug.zilla.vynce at neverbox.com>
To: <kst at kde.org>
Sent: Wednesday, January 27, 2010 3:52 PM
Subject: Re: [Kst] Adding lots of curves through KstScript is slow


> Andrew,
>
> Thanks for adding the ability to disable repaints. I'll try it out and
> let you know how it works.
>
> After some further investigation on my own today, it appears that the
> paintAll() function gets incredibly slow as more curves are added. A
> full repaint occurs every time a curve is added to a plot and twice
> every time a curve is added to a legend through KstScript. I've
> attached a patch that removes these calls to paintAll().
>
> Without this patch applied, it would take 35 minutes to load a file
> with 308 curves and 28,800 samples per curve through KstScript. With
> this patch applied, the same file loads in 25 seconds! I haven't seen
> any negative side effects of removing these calls to paintAll().
>
> I'm sure that your patch will also produce similar results. Let me
> know what you think about removing these paintAll() calls as well.
>
> Michael
>
> On Mon, Jan 25, 2010 at 10:10 AM, Michael Vincent 
> <bug.zilla.vynce at neverbox.com> wrote:
>> I'm running Kst 1.8.0 on Fedora 10.
>>
>> I sometimes deal with data files with 200+ fields and 70,000+ samples
>> per field. I setup all of the plots through KstScript and everything
>> goes pretty quickly until I start appending curves to the plot's
>> CurveCollection. The first few curves get added quickly, but adding
>> each additional curve takes exponentially longer -- like 30 minutes
>> for a data file with 300 fields. Most of the curves get added to one
>> plot.
>>
>> Looking at the code in kst2dplot.cpp, it appears that the whole plot
>> and all of its curves get completely repainted every time a new curve
>> is added. If this is the case, one solution would be to make it
>> possible to add an array of curves to a plot at once. That way, all of
>> the painting and range calculations only need to be done once.
>>
>> A more hacky workaround would be to add a KstScript function to
>> suspend and resume painting. Painting could be suspended before adding
>> curves and then resumed again afterwards.
>>
>> Another alternative would be to schedule a repaint a second or two in
>> the future when a curve is added. The repaint would get rescheduled
>> every time a curve is added. So as long as you're adding curves
>> rapidly, the painting gets delayed.
>>
>> I know you're all very busy with Kst2, but hopefully someone can help
>> me with this.
>>
>> Thanks,
>> Michael
>>
>



--------------------------------------------------------------------------------


> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst
>



More information about the Kst mailing list