Re: Another PL/I cant
From: jan van oosterwijk (jvo_36_at_hotmail.com)
Date: 08/27/04
- Next message: bv: "Re: Numeric leak"
- Previous message: keith bierman: "Re: What do you prefer: real(8) or double precision and why?"
- Next in thread: David Frank: "Re: Another PL/I cant"
- Reply: David Frank: "Re: Another PL/I cant"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: bv: "Re: Numeric leak"
- Previous message: keith bierman: "Re: What do you prefer: real(8) or double precision and why?"
- Next in thread: David Frank: "Re: Another PL/I cant"
- Reply: David Frank: "Re: Another PL/I cant"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|