Skip to content

Improve speed of console when it contains a lot of output #6042

Closed

Description

@jmcphers

Repro

  1. Create a new R session
  2. Execute a command that creates lots of R console output, several times.
  3. Attempt to execute a command in the R console

Problem

As the R console output grows, the console gets progressively more sluggish (and the rest of the UI can too). There's lag between pressing a key and seeing a letter appear, and between pressing Enter and having the command submit.

This happens because the number of DOM elements grows unbounded, and the browser struggles with layouts/reflows as a result.

We currently cap the number of lines in the console history to 1000 to help mitigate this effect, but that's an undesirable solution long-term:

  • 1000 lines is not enough to capture long script outputs (arguably those should be captured with sink() but that's very sophisticated for some users)
  • 1000 lines is--simultaneously--too many for some machines to handle; in recent versions of Chrome this seems to have gotten worse.

We made it possible for users to adjust this themselves in #5919, which provides some limited mitigation for the users experiencing the most pain, but the best solution here is probably to virtualize the console contents, perhaps using Ace or similar, so that we don't have to manage the whole thing in the DOM.

Note

In RStudio 1.3 it is possible to mitigate this with an option, so make sure it's disabled:

rstudioapi::writeRStudioPreference("console_line_length_limit", 2000L)

(requires a restart of the session and browser reload)

Internal support tickets: 43250, 43320, 43158, 43233

Activity

  1. rmccombie commented on Feb 25, 2020

    @rmccombie

    Additional internal support ticket: 44727

  2. added this to the v1.4 milestone on Jul 8, 2020
  3. kevinushey commented on Oct 15, 2020

    @kevinushey
    Collaborator

    I'm still seeing code cut off in unexpected ways with this feature on:

    Screen Shot 2020-10-15 at 3 38 24 PM

    It seems like, after a particular piece of console input, we're only retaining the last 1000 lines of output.

  4. kevinushey commented on Oct 15, 2020

    @kevinushey
    Collaborator

    After reloading the UI (Right click -> Reload), I see after trying to scroll back to the top:

    Screen Shot 2020-10-15 at 3 42 14 PM

    So it seems like the console history is then truncated in the "regular" way.

  5. gtritchie commented on Oct 15, 2020

    @gtritchie
    Member

    @kevinushey Want to add your findings to #7918

    Seems like essentially the same problem?

  6. kevinushey commented on Oct 15, 2020

    @kevinushey
    Collaborator

    Thanks! I've done so.

  7. kfeinauer commented on Nov 16, 2020

    @kfeinauer
    Contributor

    Verified that the performance issue seems to have gone away with this change. Tested with latest dailies. Aside from the strangeness reported in #7918.

  8. rmccombie commented on Dec 1, 2020

    @rmccombie

    Is there a preview release I can suggest in 44727?

  9. adamconroy commented on Dec 1, 2020

    @adamconroy
    Contributor

    There is an outstanding bug (#8428) that may or may not be a blocker for the customer. I'm actively working on the fix but it's not ready yet. If they get latest, by default, the new feature that limits console output will be turned on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions