[Rd] Windows Rgui.exe 4.2.0: Call of txtProgressBar() slows down dramatically after subsequent calls

Tobias Schoch tob|@@@@choch @end|ng |rom |hnw@ch
Thu May 19 20:37:30 CEST 2022


The issue appears in Rgui.exe version 4.2.0 (called "new" version; see bottom). The issue does NOT appear with Rterm.exe (same R version).

I provide a minimal example (foo) below. If I run function foo 3 times in a row, the execution time increases considerably (although it should not).

1st foo call: 5 seconds
2nd foo call: 13 seconds
3rd foo call: 20 seconds

The execution time keeps increasing when I call foo more often. In addition, Rgui.exe becomes laggy in taking input from the keyboard.

Sometimes, but rarely, I observe that Rgui.exe terminates with "Error: C stack usage is too close to the limit". Unfortunately, I cannot reproduce the stack error consistently.

On the "old" Rgui.exe version 4.1.2, execution time stays roughly constant over consecutive calls of foo (as expected). Unfortunately, I do not have a running 4.1.3 version; thus, I cannot tell how it behaves there.

Do you have any clue why this happens?

Kind regards,
Tobias


#------------------------------
# minimal working example: interestingly, the issue does not occur
# when 'style = 1' in txtProgressBar()
foo <- function(n)
{
    p_bar <- txtProgressBar(style = 3)
    for (i in 1:n) {
        Sys.sleep(0.01)
        setTxtProgressBar(p_bar, i / n)
    }
    close(p_bar)
}
# 1st call
system.time(foo(100))
# 2nd call
system.time(foo(100))
# 3rd call
system.time(foo(100))
#------------------------------


My R versions: 

"Old" Rgui.exe
    R version 4.1.2 (2021-11-01)
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    Running under: Windows 10 x64 (build 19044)

"New" Rgui.exe
    R version 4.2.0 (2022-04-22 ucrt)
    Platform: x86_64-w64-mingw32/x64 (64-bit)
    Running under: Windows 10 x64 (build 19044)


------------------------------------------------------------------
Fachhochschule Nordwestschweiz FHNW 
Hochschule für Wirtschaft 
Institute for Competitiveness and Communication
Empirische Wirtschafts- und Sozialforschung

Prof. Dr. Tobias Schoch
Riggenbachstrasse 16
CH-4600 Olten
Schweiz / Switzerland
------------------------------------------------------------------
T +41 62 957 21 02
Mail tobias.schoch using fhnw.ch
http://www.fhnw.ch/de/personen/tobias-schoch



More information about the R-devel mailing list