[R-SIG-Mac] quartz device extremely slow (2.7.0)
Tomas Mikoviny
tomas.mikoviny at gmail.com
Sun Apr 27 19:39:01 CEST 2008
I read it once again. You wrote:
>> The solution we used (in gdrawpolyline, in
>> src/extra/graphapp/gdraw.c) was to split the drawing into
>> pieces of length 1000, and that could be used here. It would
>> be a simple modification to RQuartz_Polyline and
>> RQuartz_Polygon, so please try it and let us know how you get
>> on.
I understood it unfortunately that modification is supposed to be done
in RQuartz_Polyline or RQuartz_Polygon.
Right now I am away from my computer so I'll check it tomorrow and let
you know.
To alter anything in my case it takes some time, I'm quite new to C
programing. However I give a try.
Thanks for patience.
tomas
On 27 Apr 2008, at 16:50, Prof Brian Ripley wrote:
> On Sun, 27 Apr 2008, Tomas Mikoviny wrote:
>
>> OK I've checked the RQuartz_Polyline and RQuartz_Polygon. Its quite
>> straight forward. However I don't see anything causing problem we
>> discuss.
>
> Please read what I actually asked you to do -- yes, I do know the
> code, but I asked you to change it following gdraw.c and test the
> change.
>
>> tomas
>> # Revision 45515: /branches/R-2-7-branch/src/library/grDevices/src
>> -----------
>> static void RQuartz_Polyline(int n, double *x, double *y, CTXDESC)
>> {
>> if (n < 2) return;
>> int i;
>> DRAWSPEC;
>> if (!ctx) NOCTX;
>> SET(RQUARTZ_STROKE | RQUARTZ_LINE);
>> CGContextBeginPath(ctx);
>> CGContextMoveToPoint(ctx, x[0], y[0]);
>> for(i = 1 ; i < n; i++)
>> CGContextAddLineToPoint(ctx, x[i], y[i]);
>> CGContextStrokePath(ctx);
>> }
>> static void RQuartz_Polygon(int n, double *x, double *y, CTXDESC)
>> {
>> if (n < 2) return;
>> int i;
>> DRAWSPEC;
>> if (!ctx) NOCTX;
>> SET(RQUARTZ_FILL | RQUARTZ_STROKE | RQUARTZ_LINE);
>> CGContextBeginPath(ctx);
>> CGContextMoveToPoint(ctx, x[0], y[0]);
>> for(i = 1; i < n; i++)
>> CGContextAddLineToPoint(ctx, x[i], y[i]);
>> CGContextClosePath(ctx);
>> CGContextDrawPath(ctx, kCGPathFillStroke);
>> }
>> ------------
>> On 27 Apr 2008, at 15:08, Prof Brian Ripley wrote:
>>
>> Some versions of Windows GDI have a superficially identical
>> problem -- stroking a path is quadratic in the number of
>> segments. The solution we used (in gdrawpolyline, in
>> src/extra/graphapp/gdraw.c) was to split the drawing into
>> pieces of length 1000, and that could be used here. It would
>> be a simple modification to RQuartz_Polyline and
>> RQuartz_Polygon, so please try it and let us know how you get
>> on.
>>
>> It would also have been helpful to (C-level) profile the call
>> and find out where the time is being spent -- I expect it not
>> to be in R at all but in Quartz.
>>
>> On Sun, 27 Apr 2008, Tomas Mikoviny wrote:
>>
>> I found where is the problem, however have no
>> solution for it right now.
>>
>> To demonstrate (I have chosen 6000 to match my
>> datasets size):
>>
>> x=seq(1:6000)
>>
>> y=rnorm(6000)
>>
>> plot(x,y)
>>
>> Absolutely no problem until now, everything is
>> responsive, no lags.
>>
>> Problem appears when I insert parameter 'type':
>>
>> slowdown and unacceptable lag for "l", "o", "s"
>>
>> plot(x,y, type="l")
>>
>> plot(x,y, type="o")
>>
>> ...
>>
>> however no problem at all (instantly plotted)
>> for "p", "b", "c", "h"
>>
>> plot(x,y, type="p")
>>
>> plot(x,y, type="b")
>>
>> ...
>>
>> Does anyone know possible reason for this
>> behaviour. Once again, I use
>>
>> clear install of R version 2.7.0 (2008-04-22).
>> When I try the same
>>
>> stuff with latest 2.6.2 version everything runs
>> smoothly without any
>>
>> problems.
>>
>> tomas
>>
>> On 27 Apr 2008, at 10:49, Charles Hebert wrote:
>>
>> Hi all,
>>
>> I've the same problem + the resizing
>> of the window is really really
>>
>> slow... for all datasets. I'm running
>> leopard 10.5.2 and the latest
>>
>> macOS R dmg.
>>
>> For all datasets. But when i use
>> quartz() then plot, it seems ok
>>
>> (slow again but... usable). So right
>> now, i use quartz(file,
>>
>> type="pdf")...
>>
>> Best regards,
>>
>> Charles
>>
>> _______________________________________________
>>
>> R-SIG-Mac mailing list
>>
>> R-SIG-Mac at stat.math.ethz.ch
>>
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>
>> --
>> Brian D. Ripley, ripley at stats.ox.ac.uk
>> Professor of Applied Statistics,
>> http://www.stats.ox.ac.uk/~ripley/
>> University of Oxford, Tel: +44 1865 272861
>> (self)
>> 1 South Parks Road, +44 1865 272866 (PA)
>> Oxford OX1 3TG, UK Fax: +44 1865 272595
>>
>
> --
> Brian D. Ripley, ripley at stats.ox.ac.uk
> Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel: +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-SIG-Mac
mailing list