Re: Another PL/I cant

From: jan van oosterwijk (jvo_36_at_hotmail.com)
Date: 08/27/04


Date: 27 Aug 2004 12:57:33 -0700


"David Frank" <dave_frank@hotmail.com> wrote in message news:<uZlWc.51492$wM.42598@twister.tampabay.rr.com>...
> "Mark Yudkin" <myudkinATcompuserveDOTcom@nospam.org> wrote in message
> news:cgc170$pee$1@ngspool-d02.news.aol.com...
> >
> > Robin already posted a solution that was approximately 100 times faster
> >
 [ .. ]
If you want to prove anything at all.. at least stick to standard Fortran.

> Statement 1 using a READ takes 1.8 sec when 2,3 are commented out
> Statement 2 using a FORALL takes 0.5 sec when 1,3 are "
> Statement 3 using a TRANSFER takes 2.1 sec when 1,2 are "

> program hex_to_string ! benchmarking
> character(48) :: hex = '414D51204D5153443120202020202020CE361F4120007711'
> character(24) :: string
> integer :: digit(48:70) = [0,1,2,3,4,5,6,7,8,9,0,0,0,0,0,0,0, &
> 10,11,12,13,14,15]
 ! Standard is (/ ... /)
> integer :: t1(8), t2(8)
>
> call date_and_time( values = t1)
> do n = 1,100000
>
> ! Statement 1
> read (hex,'(<len(string)>z2)') (string(i:i),i=1,len(string))

 ! 1. Non standard format < .. >
 ! 2. Z format only for integers

 [JvO]

> ! Statement 2
> forall(i=1:len(hex)-1:2) string(i/2+1:i/2+1) =
> char(digit(ichar(hex(i:i)))*16 +digit(ichar(hex(i+1:i+1))))
>
> ! Statement 3
> string =
> transfer([(char(digit(ichar(hex(i:i)))*16+digit(ichar(hex(i+1:i+1)))),i=1,len(hex)-1,2)],string)
>
> ! each statement above creates identical string from hex
> end do
>
> call date_and_time( values = t2)
> write (*,*) t1(6:), t2(6:) ! output start, stop hh,mm.ss.sss
> end program



Relevant Pages

  • Re: Date format detection
    ... Specifies the locale for which the date string is to be formatted. ... date format for this locale. ... the system default-date format for the specified locale. ... be enclosed within single quotation marks in the date format picture. ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Date format detection
    ... > Specifies the locale for which the date string is to be formatted. ... > date format for this locale. ... > the system default-date format for the specified locale. ... > be enclosed within single quotation marks in the date format picture. ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Date confusion
    ... Read my reply elsewhere in this string. ... > integer portion of the value represents the date as the number of days ... >> If you are working with a numeric date and you want the format DDMMYYYY, ... Another reason for preferring to store a date as text would be personal preference. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Regular Expression - old regex module vs. re module
    ... If you want to include backslashes in a string, ... a one character string, which is unlikely to be what you wanted. ... formating characters before a format, then you should use a negative ... #read in and parse a format template ...
    (comp.lang.python)
  • Re: Regular Expression - old regex module vs. re module
    ... The ReportTemplate class reads a template file or string containing a ... header and line format for multiple calls with sequence data. ... def _format: ...
    (comp.lang.python)