ruby / debug

Debugging functionality for Ruby
BSD 2-Clause "Simplified" License
1.1k stars 125 forks source link

Slow print (STDOUT) of large objects #1075

Open AlexAvlonitis opened 4 months ago

AlexAvlonitis commented 4 months ago

Your environment

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.