You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "bd2019us (JIRA)" <ji...@apache.org> on 2019/04/12 12:35:00 UTC

[jira] [Created] (OAK-8233) new Date.getTime() can be changed to System.currentTimeMillis() to improve performance

bd2019us created OAK-8233:
-----------------------------

             Summary: new Date.getTime() can be changed to System.currentTimeMillis() to improve performance
                 Key: OAK-8233
                 URL: https://issues.apache.org/jira/browse/OAK-8233
             Project: Jackrabbit Oak
          Issue Type: Bug
            Reporter: bd2019us


Location: oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/LongUtils.java:52

Hello,
I found that System.currentTimeMillis() can be used here 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 (435ms vs 2073ms), when these two methods are invoked 5,000,000 times.




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