belugabehr commented on pull request #1067:
URL: https://github.com/apache/hive/pull/1067#issuecomment-639696365
And while on the topic, parameters also have an issue of Object
instantiation.
```
// Does not instantiate anything if DEBUG is disabled
log.debug("{}::{}", "1", "2");
// Does instantiate something if DEBUG is disabled
log.debug("{}::{}:{}", "1", "2", "3");
```
Why? Because the API for SLF4J has a few versions of the `debug()` method:
- debug(String)
- debug(String, Object)
- debug(String, Object, Object)
- debug(String, Object...)
So once you use anything more than two parameters, it has to create an
`Object[]` to store the ellipsis values, whether debug logging is enabled or
not. In the case of debug logging not being enabled, it will create a
`Object[]` every time and then quickly throw it away. Not great in tight
loops. So, again, using parameters are not a panacea of performance.
https://github.com/qos-ch/slf4j/blob/0b97c416e42a184ff9728877b461c616187c58f7/slf4j-api/src/main/java/org/slf4j/Logger.java#L230
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]