On Fri, 5 Feb 2016 10:15:41 +1100, Andrew Rowley wrote:
>On 5/02/2016 5:15, Paul Gilmartin wrote:
>> I mentioned Java. Not realistic. It produces correct answers, but
>> performance is abysmal.
>>
>Do you say that because you tried it, or because everyone says it?
>
Bad experience, probably arising from bad inexperience.
>As part of the development of the API I have been doing some performance
>testing. These are CPU times to read/report about 8GB of SMF data:
>
>DFSORT:
>CP time 0.78 s
>
>Assembler, reading every record but no reporting:
>CP time 1.24 s
>
So, DFSORT outperforms Assembler. The developers put a lot of
smarts into that. But that's what DFSORT is for, not for time zone
conversion.
>C reading every record, no report:
>CP time 1.4 s
>
>Java batch job, basic report:
>CP time 0.9 s
>+ zIIP time 2.4s
>
OK. I'm doing something very wrong. (I believe we have no zIIPs.) I'll post
my source:
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.TimeZone;
public class TimeZoneTest {
public static void main(String[] argv) throws ParseException {
SimpleDateFormat formatter = new SimpleDateFormat("dd-M-yyyy
hh:mm:ss a");
String dateInString = "22-01-2015 10:15:55 AM";
// Date date = formatter.parse(dateInString);
Date date = new Date();
TimeZone tz = TimeZone.getDefault();
// From TimeZone America/Denver
System.out.println("TimeZone : " + tz.getID() + " - " +
tz.getDisplayName());
System.out.println("TimeZone : " + tz);
System.out.println("Date : " + formatter.format(date));
// To Target TimeZone
SimpleDateFormat sdfTarget = new SimpleDateFormat("dd-M-yyyy
hh:mm:ss a");
TimeZone tzInTarget = TimeZone.getTimeZone("Asia/Pyongyang");
sdfTarget.setTimeZone(tzInTarget);
String sDateInTarget = sdfTarget.format(date); // Convert to
String first
Date dateInTarget = formatter.parse(sDateInTarget);
System.out.println("\nTimeZone : " + tzInTarget.getID() +
" - " + tzInTarget.getDisplayName());
System.out.println("TimeZone : " + tzInTarget);
System.out.println("Date (String) : " + sDateInTarget);
System.out.println("Date (Object) : " +
formatter.format(dateInTarget));
}
}
And output; not 8 GB data, but none at all:
user@OS/390.25.00: ls -al `whence java`
-rwxr-xr-x 1 OMVSKERN OMVS 106496 Jul 16 2015
/usr/lpp/java/J8.0_64/bin/java
user@OS/390.25.00: time java -version
java version "1.8.0"
Java(TM) SE Runtime Environment (build pmz6480sr1fp10-20150716_01(SR1 FP10))
IBM J9 VM (build 2.8, JRE 1.8.0 z/OS s390x-64 Compressed References
20150630_255633 (JIT enabled, AOT enabled)
J9VM - R28_jvm.28_20150630_1742_B255633
JIT - tr.r14.java_20150625_95081.01
GC - R28_jvm.28_20150630_1742_B255633_CMPRSS
J9CL - 20150630_255633)
JCL - 20150715_01 based on Oracle jdk8u51-b15
real 0m 5.01s
user 0m 2.04s
sys 0m 0.67s
user@OS/390.25.00: time java -jar zones.jar
Date = 1970-01-01 00:00:00.000 GMT
time = 1454629394839
Date = 2016-02-04 23:43:14.839 GMT
Date = 2016-02-04 16:43:14.839 America/Denver
Date = 2016-02-04 18:43:14.839 America/New_York
Date = 2016-02-04 23:43:14.839 Europe/London
Date = 2016-02-05 10:43:14.839 Australia/Canberra
Date = 2016-02-05 13:43:14.839 Pacific/Apia
Date = 2016-02-05 08:43:14.839 Asia/Pyongyang
time = 1309478400000
Date = 2011-07-01 00:00:00.000 GMT
Date = 2011-06-30 18:00:00.000 America/Denver
Date = 2011-06-30 20:00:00.000 America/New_York
Date = 2011-07-01 01:00:00.000 Europe/London
Date = 2011-07-01 10:00:00.000 Australia/Canberra
Date = 2011-06-30 13:00:00.000 Pacific/Apia
Date = 2011-07-01 09:00:00.000 Asia/Pyongyang
time = 1451606400000
Date = 2016-01-01 00:00:00.000 GMT
Date = 2015-12-31 17:00:00.000 America/Denver
Date = 2015-12-31 19:00:00.000 America/New_York
Date = 2016-01-01 00:00:00.000 Europe/London
Date = 2016-01-01 11:00:00.000 Australia/Canberra
Date = 2016-01-01 14:00:00.000 Pacific/Apia
Date = 2016-01-01 09:00:00.000 Asia/Pyongyang
time = 1451624400000
Date = 2016-01-01 05:00:00.000 GMT
Date = 2015-12-31 22:00:00.000 America/Denver
Date = 2016-01-01 00:00:00.000 America/New_York
Date = 2016-01-01 05:00:00.000 Europe/London
Date = 2016-01-01 16:00:00.000 Australia/Canberra
Date = 2016-01-01 19:00:00.000 Pacific/Apia
Date = 2016-01-01 14:00:00.000 Asia/Pyongyang
real 0m 5.62s
user 0m 3.20s
sys 0m 1.07s
user@OS/390.25.00:
(I notice that they have Samoa right, but not yet PDRK. Ubuntu
has both right. Somewhere in WWW I found instructions for
z/OS administrator to update zoneinfo. Really, that should be
automatic, simply by PTF.)
-- gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN