[R-gui] gWidgets is slow

Felix Andrews felix at nfrac.org
Fri Aug 22 11:59:54 CEST 2008


Hi gui people,

Looking for some insight into the performance of gWidgets...

I made a moderately complex GUI with about 75 interactive widgets,
mostly gedit and gdroplist; I use ggroup, gframe and glayout. With
gWidgetsRGtk2 it takes a full 45 seconds to load on my machine. With
gWidgetstcltk it takes 23 seconds. It is painful to watch, you can see
each widget being created and added in turn.

So, can anyone suggest how gWidgets might be speeded up? Or are there
tricks in usage that would make a big difference?

I have tried laying out all the widgets in an invisible (or
unattached) top-level container, and then making it visible at the
end, but that seems to have no effect on the timing.

A simple example with profiling...
    Rprof(tmp <- tempfile())
        { foo <- gwindow(); for (i in 1:10) gdroplist(letters[1:10], cont=foo) }
    Rprof()
    print(summaryRprof(tmp))
    unlink(tmp)

I ran a profile of my application's start-up, but I do not know enough
about gWidgets to be able to see what is really going on. Here are the
top few functions reported by Rprof() with the percent of time spent
in each, by self and by total.

$by.self    self.pct
sub             6.7
.Call           6.6
inherits        5.5
.identC         4.4
FUN             3.5
assign          3.3
exists          3.0
.Call.graphics  2.6
doTryCatch      2.4
match           2.3
options         2.3
standardGeneric 2.0
tryCatch        2.0
$               2.0
getClassDef     2.0
.RGtkCall       1.9
as.GType        1.9
unlist          1.9
get             1.4
ls              1.4
substring       1.4
sapply          1.2
lapply          1.2
.local          1.1

$by.total   total.pct
standardGeneric 89.9
<Anonymous>     58.0
tryCatch        27.3
[<-             26.4
tryCatchList    24.4
gdroplist       24.3
.leftBracket<-  23.6
tryCatchOne     23.4
try             23.2
inherits        22.5
.gdroplist      22.4
match           21.8
doTryCatch      20.5
is.factor       20.3
new             18.9
%in%            18.7
$               18.7
lapply          17.6
$.GObject       16.7
glabel          16.3
FUN             15.9
getClassDef     15.3
add             15.1


> sessionInfo()
R version 2.7.1 (2008-06-23)
i386-pc-mingw32

locale:
LC_COLLATE=English_Australia.1252;LC_CTYPE=English_Australia.1252;LC_MONETARY=English_Australia.1252;LC_NUMERIC=C;LC_TIME=English_Australia.1252

attached base packages:
[1] tcltk     stats     graphics  grDevices utils     datasets
methods   base

other attached packages:
[1] cairoDevice_2.8      RGtk2_2.12.6         gWidgetsRGtk2_0.0-38
gWidgetstcltk_0.0-15
[5] latticeExtra_0.5-1   lattice_0.17-13      RColorBrewer_1.0-2
gWidgets_0.0-28

loaded via a namespace (and not attached):
[1] grid_2.7.1  tools_2.7.1


-- 
Felix Andrews / 安福立
http://www.neurofractal.org/felix/
3358 543D AAC6 22C2 D336 80D9 360B 72DD 3E4C F5D8



More information about the R-SIG-GUI mailing list