376
General Discussion / Re: if self.isCoder(): post() #Programming Thread
« on: December 18, 2018, 01:29:00 am »
I have such a bad habit of that, when something goes wrong I start adding debugging lines and then the problem is fixed I delete the debug lines (that are often far too vague to be readable, like printing the letter "a" whenever something happens). Really need to be better about that.
The only thing I say is that in my experience if a piece of code is going to be running hundreds of times per frame/tick/whatever, printing to console each time can slow your program down significantly. Sometimes printing to console is more expensive than whatever you're trying to log. It can obscure where the real performance bottlenecks are. But as you said the print lines can be commented out until needed.
The only thing I say is that in my experience if a piece of code is going to be running hundreds of times per frame/tick/whatever, printing to console each time can slow your program down significantly. Sometimes printing to console is more expensive than whatever you're trying to log. It can obscure where the real performance bottlenecks are. But as you said the print lines can be commented out until needed.
I totally understand recurrence, but have suffered enough PTSD from helping other students with it, that I have cold sweats thinking about it still. (I've used it successfully many times to walk directory and or data structures, but I just cant help but be reminded of the bizarre output and strange behavior I have seen come out of other peoples code, every time I must employ recursion. Mostly because they did not properly segregate their functions into discrete parts before calling them, but still [others, it's because they dont understand how to NOT use global variables for every damn thing]. At least that PTSD causes me to be extra careful when designing functions that I know must be done re-entrantly.)