Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
Patch
Description
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 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.
Attachments
Attachments
Issue Links
- links to