Uploaded image for project: 'Atlas'
  1. Atlas
  2. ATLAS-3134

Change Date.getTime() to System.currentTimeMillis() to improve performance

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.1.0
    • None
    • None
    • Patch

    Description

      new Date() is a thin wrapper of method System.currentTimeMillis(). If it is intensively invoked in the program, the performance will be greatly damaged. 
      According to my local testing, when these two methods are invoked 5,000,000 times at the same environment, System.currentTimeMillis() can achieve a speedup to 5 times (435ms vs 2073ms).
      Therefore, if only getTime() is used for Date object, the light method System.currentTimeMillis() is highly recommended, which can also avoid creating the temporary Date object.
       

      Attachments

        1. 1.patch
          1 kB
          bd2019us

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bd2019us bd2019us
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m