Slow print (STDOUT) of large objects

Open
#1,075 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
ruby
Domain
devtools

Research direction

Start by running the reported Ruby 3.3.0 reproduction with the debug gem and stopping at binding.break, then inspect how evaluating result writes large objects to STDOUT. Done should provide a pagination or offset mechanism by default so large objects can be inspected without printing everything at once.

Written by the indexing model from the issue text.

Description

Your environment

  • ruby -v: 3.3.0
  • rdbg -v: 1.9.1

Describe the bug
Hi, I'm not sure if this is a bug or a request for an additional feature (or if there is already a way to circumvent it), but when I try to print large objects to STDOUT during the debug session, it takes ages to do so because it tries to puts everything to the screen I believe.

To Reproduce

require 'debug'

def dummy_embeddings
  arr = []
  1536.times do
    arr << 0.012312321312321
  end
  arr
end

result = []
1000.times do
  result << {
    a: 1,
    b: 2,
    dummy_embeddings: dummy_embeddings
  }
end

binding.break

# result

Expected behavior
Other debuggers add some kind of offest/"pagination" by default, when printing large objects. It would be great if this gem could do that too.

Dominant language
Ruby
Stars
1.3k
Forks
146
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from ruby/debug

All issues in ruby/debug

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.