2024 - Ruby Console is significantly slower

Sketchup Pro 2024 on Windows

If you use the Ruby Console for logging a lot of text information the program becomes very slow (as compared to previous Sketchup versions). Normally during development I log everything, but now actions that used to be instant take 5+ seconds in some cases. If I close the ruby console it goes back to normal speed.

1 Like

Also be aware that the console is much more asynchronous (than earlier versions) and debugging messages sent to STDOUT do not always appear in the console in the order they were executed.

An alternative is to start using a common method for debug messages that can direct output to an array. Later (post test) this array can be written out to a file or the console.

I do something similar to this.

Assuming that there is a local @debug Boolean variable and a @debugging array defined in your module or class:

def emit(msg)
  if @debug
    @debugging << msg
  else
    puts msg
  end
end

def debug_out
  puts @debugging.join("\n")
end

def debug_file
  IO.write(File.join(__dir__,"debug_#{Time.now.to_i}.txt"), @debugging.join("\n"))
end
1 Like