The UI freezes

I’ve noticed (anecdotally, not a rigorous diagnosis) that as the script logging window accumulates text, the UI becomes slower and slower until it is unresponsive. I’ve struggled with this ever since I started using GP about a year ago and I’ve never reported it because I assume it’s just something everyone deals with, but I’m realising that I’ve never yet heard anyone else mention this issue so maybe I’m mistaken. If this is a known bug then I’ll just keep dealing with it as best I can.

Or perhaps I’m bumping into this issue more than other users because of something weird about my process?

How do y’all debug your code? My usual strategy is to use lots of Print statements to log the progress of my code execution and to display values along the way. And if I forget to delete the Print statements when I no longer need them, then my script logger console can get quite full indeed, and eventually I have to just force-quit the application and hope I’ve saved recently so as not to lose work. If it turns out that there’s a debugger integrated into the development environment and I just haven’t noticed it’s existence all this time then I’ll feel pretty silly!

Let me know if this isn’t a well-known bug, in which case I’ll upload a sample script to replicate the bug and demonstrate what I’m talking about.

That log window was not designed to hold huge amounts of text.

The usual trick to reducing what is printed is to proxy your Print statements with something like this

var debugging : boolean = false

function MaybePrint(s : String)
   if debugging
      then Print(s)
   end
end

Then use the function MaybePrint in your code and just set that variable debugging to true when you want stuff logged and false if not.

That said, the next release significantly improves this logging so it shouldn’t have as much (if indeed any) impact on the UI

Your solution is elegant, but doesn’t help me in situations where I am in the midst of debugging. Like, say I’m working on a NoteEvent handler, and for debugging purposes, I have a Print statement in that handler. If I then play a bunch of notes, then the script logger will obviously flood with output. This means that while I’m in the midst of this particular debugging session, I need to remember to clear the logger window, by hand, frequently, or else the UI will get stuck and I’ll have to force-quit the application.

It would be helpful of the script logger could just automatically delete any output older than the most recent five or ten kilobytes of data. I can’t think of any situation where I’d want to scroll up farther than that, so I wouldn’t be losing any useful output if it did so.

Hm… maybe if we had not only a script function to open the log window but also to clear it? I guess this could be helpful.

You mean like ClearLogWindow() ?

https://gigperformer.com/docs/GPScript45/SystemFunctionList.html#ClearLogWindow

1 Like

Understood – as mentioned before, the next update does a better job handling large log windows and should eliminate the problem you are experiencing.

ummm…no…the other one… you know… :innocent: :blush:
Excellent, how fast you implemented this!
(I really should read before i start to write :grimacing:)

But seriously, this could then be the solution, as long as the next version isn’t released yet. :+1:

1 Like

I use it all the time :wink: :+1: