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

[jira] [Updated] (STORM-3375) Date.getTime() can be changed to System.currentTimeMillis()

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

bd2019us updated STORM-3375:
----------------------------
    Description: 
Hello, 
I found two locations of Date.getTime() which can be replaced with System.currentTimeMillis()
(1) external/storm-hive/src/main/java/org/apache/storm/hive/bolt/mapper/DelimitedRecordHiveMapper.java:134
(2) external/storm-hive/src/main/java/org/apache/storm/hive/bolt/mapper/JsonRecordHiveMapper.java:121

Since new Date() is a thin wrapper of method System.currentTimeMillis().  The performance will be greatly damaged if it is invoked too much time.
According to my local testing at the same environment. System.currentTimeMillis() can achieve a speedup up to 5 times (435ms vs 2073ms). when these two methods are invoked 5,000,000 times , 
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:
Hello, 
I found two locations of Date.getTime() which can be replaced with System.currentTimeMillis()
(1)
external/storm-hive/src/main/java/org/apache/storm/hive/bolt/mapper/DelimitedRecordHiveMapper.java:134
(2)
external/storm-hive/src/main/java/org/apache/storm/hive/bolt/mapper/JsonRecordHiveMapper.java:121

Since new Date() is a thin wrapper of method System.currentTimeMillis().  The performance will be greatly damaged if it is invoked too much time.
According to my local testing at the same environment. System.currentTimeMillis() can achieve a speedup up to 5 times (435ms vs 2073ms). when these two methods are invoked 5,000,000 times , 
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.


> Date.getTime() can be changed to System.currentTimeMillis()
> -----------------------------------------------------------
>
>                 Key: STORM-3375
>                 URL: https://issues.apache.org/jira/browse/STORM-3375
>             Project: Apache Storm
>          Issue Type: Bug
>            Reporter: bd2019us
>            Priority: Major
>
> Hello, 
> I found two locations of Date.getTime() which can be replaced with System.currentTimeMillis()
> (1) external/storm-hive/src/main/java/org/apache/storm/hive/bolt/mapper/DelimitedRecordHiveMapper.java:134
> (2) external/storm-hive/src/main/java/org/apache/storm/hive/bolt/mapper/JsonRecordHiveMapper.java:121
> Since new Date() is a thin wrapper of method System.currentTimeMillis().  The performance will be greatly damaged if it is invoked too much time.
> According to my local testing at the same environment. System.currentTimeMillis() can achieve a speedup up to 5 times (435ms vs 2073ms). when these two methods are invoked 5,000,000 times , 
> 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)