[slf4j-dev] Boxing costs for primitive types

Curt Arnold carnold at houston.rr.com
Thu Aug 4 07:55:57 CEST 2005


It would seem fairly common to want to do something like:

for (int i = 0; i < 100; i++) {
    logger.debug("Iteration {}", i);
}

However, I believe the current SLF4J would incur an boxing cost to  
create an Integer object on each iteration regardless of whether the  
message would be dispatched and would require an explicit new Integer 
(i) prior to JDK 1.5.

Any thoughts on adding methods like:

void debug(String pattern, int arg1);
void debug(String pattern, double arg1);
void debug(String pattern, boolean arg1);





More information about the slf4j-dev mailing list