[
https://issues.apache.org/jira/browse/ATLAS-3134?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
bd2019us updated ATLAS-3134:
----------------------------
Description:
{color:#333333}Location:
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasTypeDefGraphStoreV2.java:527{color}
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
up 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.
was:
{color:#333333}Location:
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasTypeDefGraphStoreV2.java:527{color}
{color:#333333}new Date() is just a thin wrapper around
System.currentTimeMillis(). It will improve performance by using
System.currentTimeMillis() which can get the same current time stamp with
Date.getTime(). For example, I have run both of them for 5,000,000 times and
the running time is 2073ms vs 435ms{color}
> Change Date.getTime() to System.currentTimeMillis() to improve performance
> --------------------------------------------------------------------------
>
> Key: ATLAS-3134
> URL: https://issues.apache.org/jira/browse/ATLAS-3134
> Project: Atlas
> Issue Type: Bug
> Reporter: bd2019us
> Priority: Major
> Attachments: 1.patch
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> {color:#333333}Location:
> repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasTypeDefGraphStoreV2.java:527{color}
>
> 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 up 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.
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)