[Rd] Speed issue when writing to RGui console from tcl/tk GUI

From: Richard Cotton <richierocks_at_gmail.com>
Date: Mon, 19 Dec 2011 10:34:03 +0000


It seems that there are speed issues when printing to the R console from a tcl/tk GUI.

Here are functions to write a lot of output, and to display how long it takes.

printsalot <- function(n)
{

  for(i in 1:n) cat(i, fill = TRUE)
}

timings <- function(n = 1e3)
{

  print(system.time(printsalot(n)))
}

Calling timings() from the console reveals a run time of a few hundredths of a second.

The following GUI has two buttons. Clicking the "slow" buttons just calls timings directly, and takes several seconds to run. However, if we request input from the console, via readline (the "fast" button) then the timing drops back down to hundredths of a second.

library(tcltk)

win <- tktoplevel()
btn1 <- ttkbutton(win, text = "slow", command = function() timings())
btn2 <- ttkbutton(win, text = "fast", command = function() {readline("Press
ENTER > "); timings()})
tkpack(btn1, btn2)

I've only observed this slow behaviour with RGui on Windows (XP) - it doesn't happen with Rterminal or eclipse/StatET or RStudio.

I want a few people to run this code to see if it affects, for example, other OSes, to narrow down the extent of the problem before I submit it as a bug.

Also, if you have any insight as to what is happening or fixes, I'd be interested to know.

Regards,
Richie.

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 19 Dec 2011 - 12:42:20 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 20 Dec 2011 - 14:20:18 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive