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

Ceki Gulcu (JIRA) noreply-jira at qos.ch
Sun Jun 14 21:39:10 CEST 2009


    [ http://jira.qos.ch/browse/LBCLASSIC-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11179#action_11179 ] 

Ceki Gulcu edited comment on LBCLASSIC-36 at 6/14/09 9:38 PM:
--------------------------------------------------------------

Thank you for this contribution. I have ran a modified (and simplified) version of your tests. It looks like SimpleDateFormat and Yoda time have roughly the same performance, with the former having the edge.

Your version of the test had Yoda time transform Date objects. However, in logback, a "long" as obtained by System.currentMillis(), needs to be transformed. Transforming Date objects is pretty much beside the point,  invalidating any argument made by the test you contributed. 

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.

      was (Author: noreply.ceki at qos.ch):
    Thank you for this contribution. I have ran a modified (and simplified) version of your tests. It looks like SimpleDateFormat and Yoda time have roughly the same performance. with the former having the edge.

Your version of the test had Yoda time transform Date objects. However, in logback, a "long" as obtained by System.currentMillis(), needs to be transformed. Transforming Date objects is pretty much beside the point.

  
> Synchronization of SimpleDateFormat object in DateConverter
> -----------------------------------------------------------
>
>                 Key: LBCLASSIC-36
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-36
>             Project: logback-classic
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: unspecified
>         Environment: Operating System: All
> Platform: All
>            Reporter: Anders Hammar
>            Assignee: Ceki Gulcu
>         Attachments: DateConverter_patch.java, dateformattest.zip
>
>
> According to the API documentation of SimpleDateFormat, date formats are not synchronized and it is recommended to create separate format instances for each thread.
> However, a possibly simpler (mer efficient) solution would be to synchronize on the SimpleDateFormat object in the convert() method to prevent two threads to access it concurrently.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list