Page 1 of 2
Why is print() so expensive?
Posted: Fri Apr 10, 2015 10:19 am
by Bindie
Printing to the console, why so expensive? Curious.
Re: Why is print() so expensive?
Posted: Fri Apr 10, 2015 11:03 am
by s-ol
Bindie wrote:Printing to the console, why so expensive? Curious.
Because, when you disable IO buffering, it has to push every single character through all the OS' rusty pipes.
Re: Why is print() so expensive?
Posted: Fri Apr 10, 2015 12:52 pm
by undef
Expensive compared to what?
Re: Why is print() so expensive?
Posted: Fri Apr 10, 2015 1:51 pm
by Bindie
S0ll0s: Right, since no memory is available.
Undef: Functions in general, math.random() kinda
Re: Why is print() so expensive?
Posted: Fri Apr 10, 2015 3:32 pm
by s-ol
Bindie wrote:S0ll0s: Right, since no memory is available.
is that supposed to be sarcasm? Unbuffered IO is generally expensive.
Re: Why is print() so expensive?
Posted: Fri Apr 10, 2015 3:51 pm
by Bindie
Naw, no no. I didn't understand buffering had to do with memory. No memory = printing every single character then next and so on...
Re: Why is print() so expensive?
Posted: Mon Apr 13, 2015 5:06 pm
by I~=Spam
Out of curiosity... why is unbuffered io used? Is it so that if love crashes the console will still have all output? Or is it something else?
Re: Why is print() so expensive?
Posted: Mon Apr 13, 2015 5:34 pm
by undef
Printing is mainly used for debugging purposes, so you usually wouldn't print out hundreds of lines of code per frame.
Therefore it isn't regarded as an efficiency impairment for game development.
Re: Why is print() so expensive?
Posted: Tue Apr 14, 2015 1:00 am
by I~=Spam
undef wrote:Printing is mainly used for debugging purposes, so you usually wouldn't print out hundreds of lines of code per frame.
Therefore it isn't regarded as an efficiency impairment for game development.
Ahh that makes sense.
Re: Why is print() so expensive?
Posted: Tue Apr 14, 2015 3:01 am
by s-ol
I~=Spam wrote:Out of curiosity... why is unbuffered io used? Is it so that if love crashes the console will still have all output? Or is it something else?
Plus not having console debug output during tests running sucks a lot.