Skip to content

Slow prompt with large variables #5236

Closed

Description

@kubouch

Describe the bug

When I have a variable of a significant size (100s megabytes, gigabytes), the REPL update slows down considerably.

How to reproduce

  1. let x = (0..2000000 | each {|i| { foo: $i }})
  2. Press enter to get x
  3. Pres enter again to go to a new REPL line: You'll notice it takes some time now for the prompt to appear

Expected behavior

Not to be so slow with large variables.

Screenshots

No response

Configuration

key value
version 0.61.1
branch
tag
short_commit 76079d5
commit_hash 76079d5
commit_date 2022-04-18 22:28:01 +00:00
build_os linux-x86_64
rust_version rustc 1.60.0 (7737e0b5c 2022-04-04)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.60.0 (d1fd9fe 2022-03-01)
pkg_version 0.61.1
build_time 2022-04-19 09:04:08 +03:00
build_rust_channel release
features dataframe, default, trash, which, zip
installed_plugins gstat

Additional context

I'm wondering if it's the stack getting cloned somewhere (NuCompleter? prompt_update()?) that causes the slowdown.

Activity

  1. added
    category:bug
    deprecated:optimization
    on Apr 19, 2022
  2. sophiajt commented on Apr 19, 2022

    @sophiajt
    Contributor

    A couple guesses, though we'll need to profile to know for sure:

    • the resulting table has a large footprint in memory. I tried the example on my mac and it jumps from 10.6megs of memory usage to 2.2 gigs after that call.
    • we'll need to understand what exactly is taking the space. I suspect the Spans are killing us here memory-wise but it could be other things
    • Each time you hit enter, I think we're copying the stack at some point, perhaps a few times, and we might want to track these down. IIRC there was some cloning to get things ready for reedline's trait implementors.
    • We may want to Arc the stack? Not sure
  3. added
    performance
    on Aug 31, 2022
  4. FilipAndersson245 commented on Oct 28, 2022

    @FilipAndersson245
    Contributor

    This is quite annoying, I'm doing some large nushell benchmarks and I have a significant slowdown in my terminal between prompts after running the.

  5. IanManske commented on May 12, 2024

    @IanManske
    Member

    Should be fixed with parent Stacks from #11654.

  6. added this to the v0.92.0 milestone on May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    category:bugdeprecated:optimizationperformance

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions