Bug 108026 - Fix performance problem in axis labels
Summary: Fix performance problem in axis labels
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-24 00:22 UTC by Andrew Walker
Modified: 2005-10-12 01:14 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Starting patch (21.23 KB, patch)
2005-06-24 20:44 UTC, George Staikos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2005-06-24 00:22:27 UTC
Version:           HEAD (using KDE KDE 3.3.0)
OS:                Linux

Geroge, please provide more details so that this can be addressed.
Comment 1 George Staikos 2005-06-24 04:18:34 UTC
There is debug output in Kst to illustrate the problem.  See below.  We keep 
reusing the same label which causes many problems (and is verifiably slow).

1) we do 2 draws into a pixmap
2) we constantly reparse
3) the old label parser is slow (and incorrect)

kst: >>>>>>>>>>>>>>>>>>>> DRAWING PLOT P3
kst: label: old text was [] new text is [1]
kst: Did draw in width()
kst: label: old text was [1] new text is [10]
kst: Did draw in width()
kst: label: old text was [10] new text is [100]
kst: Did draw in width()
kst: label: old text was [100] new text is [1000]
kst: Did draw in width()
kst: label: old text was [1000] new text is [10^{4}]
kst: Did draw in width()
kst: label: old text was [10^{4}] new text is [10^{5}]
kst: Did draw in width()
kst: label: old text was [] new text is [0.001]
kst: Did draw in width()
kst: label: old text was [0.001] new text is [0.01]
kst: Did draw in width()
kst: label: old text was [0.01] new text is [0.1]
kst: Did draw in width()
kst: P3: x_px = 955 xright_bdr_px = 31 xleft_bdr_px = 77 y_px = 198 
ybot_bdr_px = 44 ytop_bdr_px = 30
kst: Did draw in width()
kst: Did draw in width()
kst: Did draw in width()
kst:         Lines clocks: 150000
kst: Plotting curve 0: 179ms
kst:     Without locks: 179ms
kst:             Lines: 179ms
kst:         Lines clocks: 140000
kst: Plotting curve 1: 189ms
kst:     Without locks: 189ms
kst:             Lines: 189ms
kst: Plot Benchmark stats:
kst:    Initialization: 12ms
kst:    Plot Labels: 4ms
kst:    Plot Images: 0ms
kst:    Plot Grid Lines: 0ms
kst:    plot Legend: 0ms
kst:    Plot Curves: 368ms
kst:    plot Axes: 1ms
kst:    plot Markers: 0ms
kst:    plot arbitrary Labels: 0ms
kst:    Flush Painter: 122ms
kst: Plot Total: 507ms
kst:    -> object P3 took 508ms
kst:  -> Parent class took 943ms

Note that these stats are very skewed, but the label plotting is in fact very 
expensive in some cases.  quietriot.js illustrates the problem quite nicely.

There is a new KstPlotLabel class which is just a tool (probably incomplete) 
for Kst2DPlot to draw labels with the new renderer.  Tests show that the new 
one is very fast and allows us to bypass much of the overhead associated with 
KstLabel.
Comment 2 Nicolas Brisset 2005-06-24 09:12:01 UTC
A related (I hope !) question: will this new class allow labels to be updated automatically (like when plot titles indicate datasources and the datasource changes) ?
Comment 3 George Staikos 2005-06-24 14:39:46 UTC
On Friday 24 June 2005 03:12, Nicolas Brisset wrote:
> 09:12 ------- A related (I hope !) question: will this new class allow
> labels to be updated automatically (like when plot titles indicate
> datasources and the datasource changes) ?


  The first step is to fix the tick labels.  After that, the top/x/y/etc 
labels can be fixed.  Those ones will need to be stored in parsed form and 
Kst2DPlot::update() will need to know that it has to redraw by calling an 
update method on the plotlabel probably.
Comment 4 George Staikos 2005-06-24 20:44:31 UTC
Created attachment 11572 [details]
Starting patch

This patch is a good starting point.  It seems to get the basic X-Y axis right,
but I haven't tested any case like rotated axes, opposite axes, etc.  Rotation,
font, and font size are disabled in the plot dialog, and saving is removed. 
Also there are still inefficiencies.  The label is parsed twice (as opposed to
3-4 times) but only drawn once.  Storing the KstPlotLabel or the parsed label
object in the tick parameters would probably be a good idea.
Comment 5 George Staikos 2005-10-12 01:14:42 UTC
The main problem is fixed, but there are more problems.  These are not suitable for tracking here.  It's more work to file a bug report than it is to fix them individually.

There are bugs in the labeling code now, which also need to be tracked down and fixed.