Bug 224516 - Adding curves through js is slow
Summary: Adding curves through js is slow
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.8.0
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-27 20:08 UTC by Andrew Walker
Modified: 2010-01-28 23:48 UTC (History)
1 user (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 Andrew Walker 2010-01-27 20:08:11 UTC
Version:           1.8.0 (using KDE 4.3.4)
OS:                Linux
Installed from:    Compiled From Sources

Bug report follows from kst user:

=================

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.
Comment 1 Andrew Walker 2010-01-27 22:54:22 UTC
SVN commit 1081190 by arwalker:

CCBUG:224516 first draft. Add enableUpdates property on the Kst js-object. This will allow prevention of automatic repaints with each curve addition. When all curves are added call Kst.enableUpdates=true

 M  +5 -5      extensions/js/bind_arrow.cpp  
 M  +19 -19    extensions/js/bind_axis.cpp  
 M  +3 -3      extensions/js/bind_axislabel.cpp  
 M  +3 -3      extensions/js/bind_axisticklabel.cpp  
 M  +4 -4      extensions/js/bind_borderedviewobject.cpp  
 M  +5 -5      extensions/js/bind_box.cpp  
 M  +8 -8      extensions/js/bind_curvecollection.cpp  
 M  +3 -3      extensions/js/bind_ellipse.cpp  
 M  +4 -4      extensions/js/bind_group.cpp  
 M  +30 -0     extensions/js/bind_kst.cpp  
 M  +15 -0     extensions/js/bind_kst.h  
 M  +8 -8      extensions/js/bind_label.cpp  
 M  +9 -9      extensions/js/bind_legend.cpp  
 M  +6 -6      extensions/js/bind_line.cpp  
 M  +3 -3      extensions/js/bind_picture.cpp  
 M  +2 -2      extensions/js/bind_plot.cpp  
 M  +5 -5      extensions/js/bind_plotlabel.cpp  
 M  +3 -3      extensions/js/bind_timeinterpretation.cpp  
 M  +8 -8      extensions/js/bind_viewobject.cpp  
 M  +5 -5      extensions/js/bind_viewobjectcollection.cpp  
 M  +22 -9     libkstapp/kst.cpp  
 M  +5 -0      libkstapp/kst.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1081190
Comment 2 Andrew Walker 2010-01-27 23:13:24 UTC
The previous message should read enableRepaints in place of enableUpdates.

Some example code:

.
Kst.enableRepaints=false
.
<add many curves to a plot>
.
Kst.enableRepaints=true
.
Comment 3 Michael Vincent 2010-01-28 22:20:34 UTC
Changing the Kst.enableRepaints property doesn't seem to work.

From the JS console:
kst> Kst.enableRepaints=false
false
kst> Kst.enableRepaints
true

Painting also still occurs.
Comment 4 Andrew Walker 2010-01-28 23:19:07 UTC
SVN commit 1081640 by arwalker:

CCBUG:224516 add support for setting properties on the Kst object

 M  +18 -0     bind_kst.cpp  
 M  +1 -0      bind_kst.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1081640
Comment 5 Andrew Walker 2010-01-28 23:22:43 UTC
Hi Michael,

My apologies for that.

The Kst object didn't have underlying support for setting the values of the 
properties,
as they were previosuly all read-only.

I've added the necessary support and checked-in the change.

I'll mark the bug as fixed once we've done some testing at this end.

Thanks,

Andrew

----- Original Message ----- 
From: "Michael Vincent" <bug.zilla.vynce@neverbox.com>
To: <arwalker@sumusltd.com>
Sent: Thursday, January 28, 2010 1:20 PM
Subject: [Bug 224516] Adding curves through js is slow


> https://bugs.kde.org/show_bug.cgi?id=224516
>
>
> Michael Vincent <bug.zilla.vynce@neverbox.com> changed:
>
>           What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                 CC| 
> |bug.zilla.vynce@neverbox.co
>                   |                            |m
>
>
>
>
> --- Comment #3 from Michael Vincent <bug zilla vynce neverbox com> 
> 2010-01-28 22:20:34 ---
> Changing the Kst.enableRepaints property doesn't seem to work.
>
> From the JS console:
> kst> Kst.enableRepaints=false
> false
> kst> Kst.enableRepaints
> true
>
> Painting also still occurs.
>
> -- 
> Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You reported the bug.
>
Comment 6 Andrew Walker 2010-01-28 23:25:33 UTC
Testing shows that things are now working as expected.
Comment 7 Michael Vincent 2010-01-28 23:48:06 UTC
It works now. Thanks!