[
https://issues.apache.org/jira/browse/TAJO-1093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14163624#comment-14163624
]
ASF GitHub Bot commented on TAJO-1093:
--------------------------------------
GitHub user ykrips opened a pull request:
https://github.com/apache/tajo/pull/194
TAJO-1093: DateTimeFormat.to_char() is slower than SimpleDateFormat.form...
Details can be found on this line note.
https://github.com/ykrips/tajo/commit/127b2026b8b3cc010cce738706543f606dc69d18#tajo-common-src-main-java-org-apache-tajo-util-datetime-datetimeformat-java-P30
In addition, I found a defect on my patch. When specifying the minimal
width on formatString function, it could not be applied.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ykrips/tajo TAJO-1093
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tajo/pull/194.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #194
----
commit 49e021d9fba48dea73f333b865500e6bfac00e08
Author: Jihun Kang <[email protected]>
Date: 2014-10-08T15:25:53Z
TAJO-1093: DateTimeFormat.to_char() is slower than SimpleDateFormat.format()
----
> DateTimeFormat.to_char() is slower than SimpleDateFormat.format()
> -----------------------------------------------------------------
>
> Key: TAJO-1093
> URL: https://issues.apache.org/jira/browse/TAJO-1093
> Project: Tajo
> Issue Type: Improvement
> Components: data type
> Reporter: Hyoungjun Kim
> Assignee: Jihun Kang
> Priority: Minor
> Labels: datetime
> Fix For: 0.9.0
>
>
> I tested DateTimeFormat class with the below code.
> {code}
> TimeMeta tm = new TimeMeta();
> DateTimeUtil.toJulianTimeMeta(DateTimeUtil.javaTimeToJulianTime(System.currentTimeMillis()),
> tm);
> int iteration = 1000000;
> long startTime = System.currentTimeMillis();
> for (int i = 0; i < iteration; i++) {
> DateTimeFormat.to_char(tm, "YYYY-MM-DD HH24:MI:SS");
> }
> long endTime = System.currentTimeMillis();
> System.out.println("DateTimeFormat.to_char: " + (endTime - startTime) + "
> ms");
> ///////////////////////////////////////////////////////////
> SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
> Date date = new Date();
> startTime = System.currentTimeMillis();
> for (int i = 0; i < iteration; i++) {
> df.format(date);
> }
> endTime = System.currentTimeMillis();
> System.out.println("SimpleDateFormat.format: " + (endTime - startTime) + "
> ms");
> ///////////////////////////////////////////////////////////
> startTime = System.currentTimeMillis();
> for (int i = 0; i < iteration; i++) {
> DateTimeFormat.parseDateTime("2014-01-01 12:11:11", "YYYY-MM-DD
> HH24:MI:SS");
> }
> endTime = System.currentTimeMillis();
> System.out.println("DateTimeFormat.parseDateTime: " + (endTime - startTime) +
> " ms");
> ///////////////////////////////////////////////////////////
> startTime = System.currentTimeMillis();
> for (int i = 0; i < iteration; i++) {
> df.parse("2014-01-01 12:11:11");
> }
> endTime = System.currentTimeMillis();
> System.out.println("SimpleDateFormat.parse: " + (endTime - startTime) + "
> ms");
> {code}
> The following is the test result. DateTimeFormat.to_char is 20 times slower
> than SimpleDateFormat.format.
> {noformat}
> DateTimeFormat.to_char: 6993 ms
> SimpleDateFormat.format: 373 ms
> DateTimeFormat.parseDateTime: 798 ms
> SimpleDateFormat.parse: 1400 ms
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)