[R] strange slowness of plot (on Windoze)

Martin Maechler maechler at stat.math.ethz.ch
Wed Jul 25 09:16:27 CEST 2001

```Well, on Unix (and probably most other platforms), it's several orders of
magnitudes faster, *but* qualitatively similar :

Here are my findings (for a fast Linux on a not really fast graphics card):

## MM: User, System and Total
Ti <- function(expr) system.time(expr)[1:3]

## I just ran into this strange behavior.

N <- 1000 ## originally
N <- 100000# to see some slowness on Unix
y <- rnorm(N)
x <- 0:(N-1)
## Times : For N=1000, Andy Jaworski, see below
Ti(plot(x, y, type='l', lty=1))## instantaneous
Ti(plot(x, y, type='l', lty=2))## 18s plotting lines + 15s plotting axes =  33s
Ti(plot(x, y, type='l', lty=3))## 76s          ,,    + 75s       ,,      = 151s
Ti(plot(x, y, type='l', lty=4))## 40s          ,,    + 38s       ,,      =  78s

## MM : For N <- 100000, I get (on "lynne", a pretty new PIII)
##  User Sys  Total
##  ---- ---- ----
##  0.32 0.01 0.73
##  0.34 0.01 3.15
##  0.22 0.00 4.97
##  0.32 0.01 4.07

>>>>> "AndyJ" == apjaworski  <apjaworski at mmm.com> writes:

AndyJ> I just ran into this strange behavior.

AndyJ> y <- rnorm(1000)
AndyJ> x <- seq(0, length=length(y))

AndyJ> plot(x, y, type='l', lty=1)   - instantaneous
AndyJ> plot(x, y, type='l', lty=2)   - 18s plotting lines + 15s plotting axes
AndyJ> = 33s
AndyJ> plot(x, y, type='l', lty=3)   - 76s          ,,               + 75s
AndyJ> ,,            = 151s
AndyJ> plot(x, y, type='l', lty=4)   - 40s          ,,               + 38s
AndyJ> ,,            = 78s

AndyJ> A couple of observations:
AndyJ> (1) The plots for lty>1 seem to be rendered in "one chunk", that is a blank
AndyJ> graphics window appears and stays blank until all the lines appear at once.
AndyJ> Then another long wait for axes.
AndyJ> (2) While waiting for the plot, the computer becomes totally unresponsive.
AndyJ> Typical ctr-alt-del does nothing.  Even pushing the power button does
AndyJ> nothing.  I originally attempted the lty=2 plot with several hundred
AndyJ> thousand observations.  The only way I could get my machine back was to
AndyJ> disconnect the power cord!

AndyJ> My system is as follows:
AndyJ> (1) IBM Intellistation with PIII 1GHz, 512Mb of RDRAM, 20Gb SCSI160 drive,
AndyJ> 64Mb FireGL graphics card
AndyJ> (2) Windows 2000 Pro
AndyJ> (3) R-1.3.0 (original version)

AndyJ> Andy

AndyJ> __________________________________
AndyJ> Andy Jaworski
AndyJ> Engineering Systems Technology Center
AndyJ> 3M Center, 518-1-01
AndyJ> St. Paul, MN 55144-1000
AndyJ> -----
AndyJ> E-mail: apjaworski at mmm.com
AndyJ> Tel:  (651) 733-6092
AndyJ> Fax:  (651) 736-3122

AndyJ> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
AndyJ> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
AndyJ> Send "info", "help", or "[un]subscribe"
AndyJ> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
AndyJ> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>>>>> "apjaworski" == apjaworski  <apjaworski at mmm.com> writes:

apjaworski> I just ran into this strange behavior.
apjaworski> y <- rnorm(1000)
apjaworski> x <- seq(0, length=length(y))

apjaworski> plot(x, y, type='l', lty=1)   - instantaneous
apjaworski> plot(x, y, type='l', lty=2)   - 18s plotting lines + 15s plotting axes
apjaworski> = 33s
apjaworski> plot(x, y, type='l', lty=3)   - 76s          ,,               + 75s
apjaworski> ,,            = 151s
apjaworski> plot(x, y, type='l', lty=4)   - 40s          ,,               + 38s
apjaworski> ,,            = 78s

apjaworski> A couple of observations:
apjaworski> (1) The plots for lty>1 seem to be rendered in "one chunk", that is a blank
apjaworski> graphics window appears and stays blank until all the lines appear at once.
apjaworski> Then another long wait for axes.
apjaworski> (2) While waiting for the plot, the computer becomes totally unresponsive.
apjaworski> Typical ctr-alt-del does nothing.  Even pushing the power button does
apjaworski> nothing.  I originally attempted the lty=2 plot with several hundred
apjaworski> thousand observations.  The only way I could get my machine back was to
apjaworski> disconnect the power cord!

apjaworski> My system is as follows:
apjaworski> (1) IBM Intellistation with PIII 1GHz, 512Mb of RDRAM, 20Gb SCSI160 drive,
apjaworski> 64Mb FireGL graphics card
apjaworski> (2) Windows 2000 Pro
apjaworski> (3) R-1.3.0 (original version)

apjaworski> Andy

apjaworski> __________________________________
apjaworski> Andy Jaworski
apjaworski> Engineering Systems Technology Center
apjaworski> 3M Center, 518-1-01
apjaworski> St. Paul, MN 55144-1000
apjaworski> -----
apjaworski> E-mail: apjaworski at mmm.com
apjaworski> Tel:  (651) 733-6092
apjaworski> Fax:  (651) 736-3122

apjaworski> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
apjaworski> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
apjaworski> Send "info", "help", or "[un]subscribe"
apjaworski> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
apjaworski> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```