bd2019us created CLOUDSTACK-10407:
-------------------------------------

             Summary: Date.getTime() can be changed to 
System.currentTimeMillis()
                 Key: CLOUDSTACK-10407
                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-10407
             Project: CloudStack
          Issue Type: Bug
      Security Level: Public (Anyone can view this level - this is the default.)
            Reporter: bd2019us

Location:  server/src/main/java/com/cloud/api/ApiServer.java:1082

Hello,
In this file location, only getTime() is used for Date object, in this case, 
the light method System.currentTimeMillis() is recommended, which can avoid 
creating the temporary Date object.   Since new Date() is a thin wrapper of 
method System.currentTimeMillis(). The performance will be greatly damaged if 
it is invoked too much times.
According to my local testing at the same environment, 
System.currentTimeMillis() can achieve a speedup to 5 times (435ms vs 2073ms), 
when these two methods are invoked 5,000,000 times.




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to