Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-1015

DateFormat.getDateTimeInstance() is very expensive, we can cache it to improve performance

    Details

    • Type: Bug
    • Status: Patch Available
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.3.2
    • Fix Version/s: None
    • Component/s: server
    • Labels:

      Description

      In the file

       
      ./zookeeper-3.3.2/src/java/main/org/apache/zookeeper/server/PurgeTxnLog.java line:103
      

      DateFormat.getDateTimeInstance() is called many times in the for loop. We can cache the result and improve the performance

      This is similar to the Apache bug https://issues.apache.org/bugzilla/show_bug.cgi?id=48778

      Similar code can be found:

      ./zookeeper-3.3.2/src/java/main/org/apache/zookeeper/server/TraceFormatter.java
      ./zookeeper-3.3.2/src/java/main/org/apache/zookeeper/server/LogFormatter.java
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bhavanki Bill Havanki
                Reporter:
                nancyesmis Xiaoming Shi
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: