posit-dev / positron

Positron, a next-generation data science IDE
Other
1.62k stars 43 forks source link

Review Console performance of escape-character aware processing #267

Open petetronic opened 1 year ago

petetronic commented 1 year ago

In the event that a large amount of output is sent to the console, we should take another look at the performance impact of the ansi escape character aware processing that we do. It will behoove us to at least look at whether simple pre-scanning for escape characters or opportunities for reducing string concatenation will help with performance.

kevinushey commented 1 year ago

An example to stress-test with R code; printing 20 lines with 1,000,000 characters:

for (i in 1:20) {
  print(paste(sample(letters, 1E6, TRUE), collapse = ""))
}

The main concern in my mind is making sure a user is able to recover from an "overloaded" console. (Usually, clearing the console history will be enough).

We might also need to be aware of issues like this when replaying saved console outputs into the console history; we've had a couple issues in RStudio where the IDE would hang on startup as it was trying to render an overly-large saved console history.