2

On Windows I have recently updating R from 3.1.2 to 3.2.2 and updating all packages I am using as well (including cairoDevice). Now I observe that plotting under gWidgets2 shows a very poor performace, especially for pch=16,17,18:

library(gWidgets2,gWidgets2RGtk2)
options(guiToolkit="RGtk2")
win <- gwindow("Plot a figure",expand=TRUE)
gg <- ggraphics(container=win,expand=TRUE)
a <- seq(0,100,0.1) 
for (b in 1:20){
  par(pch = b)
  plot(c(0,100),c(0,100))
  start_time <- Sys.time()
  points(a,a)
  end_time <- Sys.time()
  print(paste("pch =",b,"time to plot:",end_time-start_time))
}

which gives:

[1] "pch = 1 time to plot: 0.134000062942505"
[1] "pch = 2 time to plot: 0.0380001068115234"
[1] "pch = 3 time to plot: 0.0569999217987061"
[1] "pch = 4 time to plot: 0.0550000667572021"
[1] "pch = 5 time to plot: 0.0409998893737793"
[1] "pch = 6 time to plot: 0.0379998683929443"
[1] "pch = 7 time to plot: 0.0859999656677246"
[1] "pch = 8 time to plot: 0.10699987411499"
[1] "pch = 9 time to plot: 0.0929999351501465"
[1] "pch = 10 time to plot: 0.180000066757202"
[1] "pch = 11 time to plot: 0.0740001201629639"
[1] "pch = 12 time to plot: 0.0859999656677246"
[1] "pch = 13 time to plot: 0.184999942779541"
[1] "pch = 14 time to plot: 0.062999963760376"
[1] "pch = 15 time to plot: 0.871000051498413"
[1] "pch = 16 time to plot: 49.2030000686646"
[1] "pch = 17 time to plot: 17.3880000114441"
[1] "pch = 18 time to plot: 24.2620000839233"
[1] "pch = 19 time to plot: 0.174000024795532"
[1] "pch = 20 time to plot: 0.128999948501587"

Without gWidgets2 the numbers are well below 0.1 sec. This effect is reproducable. Collegues of mine do see the same.

It must have to do with packages which I updated. Because when I remove R 3.2.2 and install 3.1.2 I don't get back the performance I had before updating everything.

Any idea??

  • Boy that is odd. Is this windows or some other OS? – jverzani Oct 16 '15 at 23:06
  • This is indeed odd. I can replicate the results on 32 bit windows, but not on 64. Is it possible for you to use a 64-bit version? Otherwise, I really have no clue where this rests. Likely it is in the Gtk libraries somewhere. If it is in gWidgets2 code I could do something, but really don't have any ideas why it would be. – jverzani Oct 19 '15 at 12:44
  • My numbers above are with With 64 bit Windows and 32 bit R. With 64 bit Windows and 64 bit R I get only slightly better figure: 36 sec for pch=16. – Thorsten O. Oct 19 '15 at 13:33
  • Boy, I wish I could help, but I just don't have any ideas. My guess is that any hope sits in the cairoDevice package. I'll work out an example and see if I can find the discrepancy there. – jverzani Oct 19 '15 at 15:52
  • I think I had version 2.20 of cairoDevice installed when it was still performing well. I tried to go back to version 2.20 but I didn't manage to do so. – Thorsten O. Oct 19 '15 at 16:41
  • I just looked for difference between 2.22 and 2.15 and don't see anything substantial except for the Gtk libraries they install when not present. My guess is the issue lies down with those libraries. Do you recall being asked to install new ones when you upgraded RGtk2 and cairoDevice? – jverzani Oct 19 '15 at 21:31
  • I installed new ones. – Thorsten O. Oct 20 '15 at 13:55

1 Answers1

0

[This is edited. At first it reported no slow down with the first method.]

This isn't really an answer, but a followup. This is strange. I have three ways to do this. The first bypasses gwidgets2:

win <- gtkWindow() gg <- gtkDrawingAreaNew() ps = 12 cairoDevice::asCairoDevice(gg, pointsize=ps) win$add(gg)

This second one is a hybrid bypassing ggraphics:

win <- gwindow() gg <- gtkDrawingAreaNew() ps <- 12 cairoDevice::asCairoDevice(gg, pointsize=ps) add(win, gg)

(a hybrid of gWidgets2 and cairoDevice)

and your original

win <- gwindow() gg <- ggraphics(cont=win)

At first I reported the first approach worked as expected, but not the latter 2. Now I see the opposite. The latter two are performing a bit better, but all perform poorly on pch=16, 17 or 18.

I think your comment about the cairoDevice package is likely apt. I tested the above using the Gtk that installed when prompted after loading RGtk2. I'm not sure how to proceed. There are other reported issues with the ggraphics device under windows all with me punting to a similar answer. Hopefully this one isn't fatal to your plans.

(I opened an issue at GitHub: https://github.com/jverzani/gWidgets2RGtk2/issues/15 to continue the discussion, as this isn't right for stackoverflow.)

jverzani
  • 5,600
  • 2
  • 21
  • 17