You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Slow local variables load in VSCode due to inspect of large variables #674
Describe the bug
VSCode is very slow to load the local variables window in my app when it stops at a breakpoint where the self object has an instance variable of type RubyXL::Worksheet (with images in it) as well as an instance variable for the parent workbook in the self because the obj.inspect in rdbg's safe_inspect is returning a very large string. See also #635 (comment) where the obj.inspect for a worksheet in the backtrace was taking nine or ten minutes to return a 16 MB string, and the comments at #635 (comment) and after.
I am running the debugger in a WSL instance, so this might be slowing things down more than running it natively.
Expected behavior
VSCode should be able to load the local variables window in a reasonable time (preferably micro or milliseconds) rather than freezing.
Additional context
One solution is to use the same fix as for #635 by using the LimitedPP.pp call instead of obj.inspect in safe_inspect, eg:
def self.safe_inspect obj, max_length: SHORT_INSPECT_LENGTH, short: false
if short
LimitedPP.pp(obj, max_length)
else
#obj.inspect
LimitedPP.pp(obj, 32768)
end
With this change, the local variables window loads in VSCode in a reasonable time.
I tried using a limit of up to 128 kB and the local variables window is noticeably slow to load but still of the order of a second.
Activity
ko1 commentedon Jul 5, 2022
Thank you the report. I try to limit in 4KB. Is it enough?
Limited to inspect string in 4KB on DAP
Limited to inspect string in 4KB on DAP
rockorequin commentedon Jul 5, 2022
Thanks, I'm sure 4KB is plenty.