Closed Pesegato closed 8 years ago
Thanks for the patch, though. I'm glad others are looking at the code.
Hum. I thought that the string format was always preferable and therefore always use the {} syntax, if nothing else to remind the "better way" of logging... oh well.
The benefit of the {} syntax is that the logging system can avoid doing the string format if the log message would be suppressed. Else string + is going to be faster. The down side of the {} syntax is that if you get it wrong then you don't know about it until that log message is output someday and your application crashes.
In this case, the savings for {} would be so small as to not be measurable (because these are logged once per app run) and considering the message is almost always output then there would be no savings at all anyway.
For readability, cut+pastability, etc. I also prefer the string + string form, personally. So you will see it's rare that I use the {} form.
On Mon, May 23, 2016 at 4:17 AM, Pesegato notifications@github.com wrote:
Hum. I thought that the string format was always preferable and therefore always use the {} syntax, if nothing else to remind the "better way" of logging... oh well.
— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub https://github.com/jMonkeyEngine-Contributions/Lemur/pull/32#issuecomment-220915455
Well... in this case not really. These are both only called once per application run first off... so any performance benefit is minor. Since the idea is that INFO messages are usually logged then we don't get much benefit from the "not logged" optimization that the format version of the method provides. So then it's a difference between a string append and a string format. The append is always going to perform better in that case. (And the compiler will catch typos.)