[Kst] Adding lots of curves through KstScript is slow

bug.zilla.vynce at neverbox.com bug.zilla.vynce at neverbox.com
Thu Jan 28 00:52:39 CET 2010


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
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kst-add-curve-paint.patch
Type: text/x-patch
Size: 1135 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kst/attachments/20100127/acdb968d/attachment.patch 


More information about the Kst mailing list