octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #40663] scatter and scatter3 terribly slow wit


From: Rik
Subject: [Octave-bug-tracker] [bug #40663] scatter and scatter3 terribly slow with real-valued color vector
Date: Fri, 22 Nov 2013 00:38:37 +0000
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:25.0) Gecko/20100101 Firefox/25.0

Follow-up Comment #5, bug #40663 (project octave):

The issue is going to occur whenever you have huge numbers of colors.  In this
case the scatter script is trying to consolidate and call the patch function
the minimum number of times necessary.  It does this by finding out which
points have the same color and grouping them.  The first examples you sent
work because the number of colors is small.  In the biggest case it is equal
to the average size colormap of 64 and the plot is nearly instantaneous.

But with 10,000 unique colors it needs to call the patch function once for
each point and that is a lot of overhead.  There might be ways to reduce this.
 One way would be to reduce the colors to the size of the colormap, since that
is the largest number that will be displayed anyways.  Before calling scatter,
for example, you could do


c_discrete = fix (rows (colormap) / range (c(:)) * (c + abs (min (c(:)))));


Longer term, patch and __go_patch__ (C++) need to be overhauled.  Not only are
they slow, but they fail to reproduce the correct coloring behavior as I
reported in another bug.  Here is some empirical data from the Octave profiler
where I used just 1,000 points (which still takes 10 seconds).  The problem
function is __go_patch__.


   #                      Function Attr     Time (s)        Calls
-----------------------------------------------------------------
   1                                  R       12.056          105
  77                  __go_patch__             9.250         1000
  73                      ancestor             0.444         1000
  16                           get             0.299         6010
  71 __scatter__>render_size_color             0.235         1000
  80                       drawnow             0.205            1
  26                   __scatter__             0.194            1
  23              __go_axes_init__             0.100            1
  70                      isscalar             0.055         2000
   4                       strcmpi             0.024         3002
   8                     binary ==             0.021         5040
  19                          true             0.019         5003
  14                        nargin             0.014         5038
   6                         numel             0.013         6009
  10                      prefix !             0.011         4021
  76                      ishandle             0.010         3000
   9                       isempty             0.009         4021
  45                           any             0.006         3008
  75                      num2cell             0.006         1000
  74                          cell             0.005         1000




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?40663>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]