[logback-dev] [JIRA] Issue Comment Edited: (LBCLASSIC-36) Synchronization of SimpleDateFormat object in DateConverter

Ceki Gulcu ceki at qos.ch
Sun Jun 14 22:07:52 CEST 2009


Thorbjoern Ravn Andersen wrote:
> Ceki Gulcu (JIRA) skrev:
>> Just as importantly, logback will invoke Yoda time or 
>> SimpleDateformat, at most once per millisecond. So the performance of 
>> SimpleDateformat as well as Yoda time are as satisfactory as they are 
>> unimportant. Only the performance of System.currentMillis really matters.
>>   
> "once per millisecond" does not merit unimportance as this might mean 
> 1000 times per second.

True. However, keep in mind that the computation performed 1000 per second takes 
2 microseconds.

> Would a reasonable optimization be "once per second" with the 
> miliseconds being hacked in afterwards?

Reasonable? Well, certainly!


Assuming the 2 microsecond cost is too much (which I find iffy), we
could add another conversion word, say, %optiTime, which would have a
precision of a second but not milliseconds. For milliseconds, the user
would use, say the %millis converter. This would gains us 2microseconds x
1000 per second, or 2 milliseconds per second, if the application was
doing logging and nothing else.

It's too much of a hassle and not worth the effort if you ask me.

-- 
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch


More information about the logback-dev mailing list