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

From: peter dalgaard <pdalgd_at_gmail.com>
Date: Tue, 20 Dec 2011 13:54:56 +0100

On Dec 19, 2011, at 11:34 , Richard Cotton wrote:

> 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.
>

Nothing of the sort is happening on OSX. The RGui console is known to be slow if unbuffered, so you may want to experiment with turning buffering on. It could also be some event handling issue, but it doesn't really seem likely to me.

-pd

> 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

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes_at_cbs.dk  Priv: PDalgd_at_gmail.com

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Tue 20 Dec 2011 - 13:00:50 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 - 18:50: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