You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "lixiaojiee (GitHub)" <gi...@apache.org> on 2019/01/11 06:38:55 UTC

[GitHub] [incubator-dubbo] lixiaojiee commented on issue #3090: Acesslog dateformat enhancemnet

SimpleDateFormat is not thread-safe, which is why we have to create new objects every time before. I did some research. Java8 currently has A thread-safe date tool called LocalDateTime. After reviewing @jasonjoo2010 's recommendation, I did some testing and found that FastDateFormat performs much better than the other two. Therefore, I also recommend FastDateFormat, but I prefer to bring it into the dubbo-commom package as a common date tool for other modules to reuse.You can refer to the data in the table below. The first column is the number of samples, and the following data is the average time corresponding to each sample in ms.

  | SimpleDateFormat | FastDateFormat | LocalDateTime
-- | -- | -- | --
10 | 3 | 1 | 77
100 | 10 | 4 | 83
1000 | 54 | 26 | 137
10000 | 170 | 52 | 168
100000 | 470 | 153 | 341
1000000 | 1827 | 501 | 1024
10000000 | 11591 | 3473 | 6228

**Note** : For environmental reasons, the above data are for reference only

[ Full content available at: https://github.com/apache/incubator-dubbo/pull/3090 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org