STONE,ROBERT (HP-SanDiego,ex1) wrote:
Just curious why you're using in your code constructs like
if ( log.debuggingIsEnabled() ) { log.debug( "foo" ); }
Isn't this redundant? After all log.debug() will only output messages when debugging level is set to DEBUG. Why not just use log.debug( "foo" )? Saves you two lines...
Because string creation & manipulation is an expensive operation in java to be avoided whenever possible. Try to do a simple string manipulation, compile the class and run javap -c on it. You'll be surprised: those two lines saved will turn out into a lot of runtime execution penalty. If the check is performed, the string manipulation is skipped.
Ciao,
-- Gianugo Rabellino Pro-netics s.r.l. - http://www.pro-netics.com Orixo, the XML business alliance - http://www.orixo.com (Now blogging at: http://blogs.cocoondev.org/gianugo/)