[ 
https://issues.apache.org/jira/browse/HELIX-816?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

bd2019us updated HELIX-816:
---------------------------
    Description: 
Locations:
(1) 
helix-core/src/main/java/org/apache/helix/messaging/handling/HelixStateTransitionHandler.java
 340
(2) helix-core/src/main/java/org/apache/helix/messaging/AsyncCallback.java 111

Hello,
I found that System.currentTimeMillis() can be used in the locations instead of 
new Date.getTime().
Since new Date() is a thin wrapper of light 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 (435 ms vs 2073 
ms), when these two methods are invoked 5,000,000 times.


  was:
Locations:
(1) 
helix-core/src/main/java/org/apache/helix/messaging/handling/HelixStateTransitionHandler.java
 340
(2) helix-core/src/main/java/org/apache/helix/messaging/AsyncCallback.java 111

Hello,
I found that System.currentTimeMillis() can be used in these three locations 
instead of new Date.getTime().
Since new Date() is a thin wrapper of light 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 (435 ms vs 2073 
ms), when these two methods are invoked 5,000,000 times.



> new Date.getTime() can be changed to System.currentTimeMillis()
> ---------------------------------------------------------------
>
>                 Key: HELIX-816
>                 URL: https://issues.apache.org/jira/browse/HELIX-816
>             Project: Apache Helix
>          Issue Type: Bug
>            Reporter: bd2019us
>            Priority: Major
>              Labels: patch
>
> Locations:
> (1) 
> helix-core/src/main/java/org/apache/helix/messaging/handling/HelixStateTransitionHandler.java
>  340
> (2) helix-core/src/main/java/org/apache/helix/messaging/AsyncCallback.java 111
> Hello,
> I found that System.currentTimeMillis() can be used in the locations instead 
> of new Date.getTime().
> Since new Date() is a thin wrapper of light 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 (435 ms vs 2073 
> ms), 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