Do debug messages effect performance?

flyinian

Member
Do debug messages effect performance or is it not much of a concern?

If it's not much of a concern, how many debug messages will it take to make it a concern?
 

O.Stogden

Member
If they're in a loop or repeated very often, then yes, show_debug_message will impact performance quite a bit.

Once a step, it probably won't make a huge difference.

Use the debugger mode (profiler) to find out what's causing lag, it'll list "show_debug_message" and tell you how much processing time it's actually using up.
 
Last edited:

rytan451

Member
While testing, they absolutely do affect performance. I have found that it is untenable to have more than 100 debug messages printed per step, at least if you want to have a smooth 60 FPS. (This was an estimate – I don't have GMS2 open right now for testing). From my experience with other programming languages, I suspect the limiting factor is GMS2 rerendering the console after a new message is printed to it. When releasing the game, this bottleneck should no longer exist.

In a release version, it is extremely unlikely that they affect performance.

If debug logging becomes a limitation while testing (unlikely – a mere 10 seconds would accumulate more than 5,000 messages for you as a debugger to go through), then you may wish to consider putting debug output into a buffer, and outputting the buffer's contents every frame.

All of that aside, debugging takes a long time, and debug messages are a real lifesaver when debugging. Do not worry about performance issues from debug logging – it's simple enough to [CTRL]+[SHIFT]+[F] and remove all the debug logging code after debugging.

TL;DR: Debug logging does affect performance while testing, is unlikely to affect performance when releasing it (building a final executable), and definitely doesn't affect performance if you delete it all. There are also ways to speed it up. However, the performance loss from debug logging is more than made up by your own gain in programming and debugging performance, so don't worry about logging too much stuff.
 

flyinian

Member
If they're in a loop or repeated very often, then yes, show_debug_message will impact performance quite a bit.

Once a step, it probably won't make a huge difference.

Use the debugger mode to find out what's causing lag, it'll list "show_debug_message" and tell you how much processing time it's actually using up.
While testing, they absolutely do affect performance. I have found that it is untenable to have more than 100 debug messages printed per step, at least if you want to have a smooth 60 FPS. (This was an estimate – I don't have GMS2 open right now for testing). From my experience with other programming languages, I suspect the limiting factor is GMS2 rerendering the console after a new message is printed to it. When releasing the game, this bottleneck should no longer exist.

In a release version, it is extremely unlikely that they affect performance.

If debug logging becomes a limitation while testing (unlikely – a mere 10 seconds would accumulate more than 5,000 messages for you as a debugger to go through), then you may wish to consider putting debug output into a buffer, and outputting the buffer's contents every frame.

All of that aside, debugging takes a long time, and debug messages are a real lifesaver when debugging. Do not worry about performance issues from debug logging – it's simple enough to [CTRL]+[SHIFT]+[F] and remove all the debug logging code after debugging.

TL;DR: Debug logging does affect performance while testing, is unlikely to affect performance when releasing it (building a final executable), and definitely doesn't affect performance if you delete it all. There are also ways to speed it up. However, the performance loss from debug logging is more than made up by your own gain in programming and debugging performance, so don't worry about logging too much stuff.

Good to know, Just curious because I have over 300 debug messages in my game and just wondering if it would have an impact.

Thank you.
 
Top