I am stunned
When testing GS' test methods I see that ooRexx needs about 100 times more
time than Regina
Where am I wrong?
Thanks
Walter
After testing some more I found that the (in this case unnecessary) Numeric
Digits 1000 makes ooRexx look bad!
See comparable results at the end of this mail when this statement is
removed!
REXX-Regina_3.9.0(MT) 5.00 16 Oct 2014 11 Mar 2015 12:00:26
24993 0.047 x.i//2
24993 0.031 pos(right(x.i,1),02468)==0
24993 0.047 pos(right(x.i,1),13579)==0
24993 0.062 right(x2b(d2x(x.i)),1)
24993 0.031 Parse... ed.ld
24993 0.032 right... ed.ld
REXX-ooRexx_4.2.0(MT)_32-bit 6.04 22 Feb 2014 11 Mar 2015 11:59:55
25040 1.622 x.i//2
25040 0.609 pos(right(x.i,1),02468)==0
25040 0.639 pos(right(x.i,1),13579)==0
25040 1.935 right(x2b(d2x(x.i)),1)
25040 4.695 Parse... ed.ld
25040 4.524 right... ed.ld
The program
/* REXX
------------------------------------------------------------------------
* Performance test rosettacode.org test if a number is even
*---------------------------------------------------------------------------
--*/
Parse Version v
Say v date() time()
ed.=0; ed.0=1; ed.2=1; ed.4=1; ed.6=1; ed.8=1 /*assign even digits to
"true".*/
numeric digits 1000 /*handle most big 'uns from the CL*/
n=50000
Do i=1 To n
x.i=random(1,100000)
End
Call time 'R'; cnt.=0; Do i=1 To n
if x.i//2 then cnt.0odd =cnt.0odd +1
else cnt.0even=cnt.0even+1
End; Say cnt.0even format(time('E'),3,3) 'x.i//2'
Call time 'R'; cnt.=0; Do i=1 To n
if pos(right(x.i,1),02468)==0 then cnt.0odd =cnt.0odd +1
else cnt.0even=cnt.0even+1
End; Say cnt.0even format(time('E'),3,3) 'pos(right(x.i,1),02468)==0'
Call time 'R'; cnt.=0; Do i=1 To n
if pos(right(x.i,1),13579)==0 then cnt.0even=cnt.0even+1
else cnt.odd =cnt.odd +1
End; Say cnt.0even format(time('E'),3,3) 'pos(right(x.i,1),13579)==0'
Call time 'R'; cnt.=0; Do i=1 To n
if right(x2b(d2x(x.i)),1) then cnt.0odd =cnt.0odd +1
else cnt.0even=cnt.0even+1
End; Say cnt.0even format(time('E'),3,3) 'right(x2b(d2x(x.i)),1)'
Call time 'R'; cnt.=0; Do i=1 To n
parse var x.i '' -1 ld /*obtain last decimal digit of Y.*/
if ed.ld then cnt.0even=cnt.0even+1
else cnt.0odd =cnt.0odd +1
End; Say cnt.0even format(time('E'),3,3) 'Parse... ed.ld'
Call time 'R'; cnt.=0; Do i=1 To n
ld=right(x.i,1)
if ed.ld then cnt.0even=cnt.0even+1
else cnt.0odd =cnt.0odd +1
End; Say cnt.0even format(time('E'),3,3) 'right... ed.ld'
REXX-Regina_3.9.0(MT) 5.00 16 Oct 2014 11 Mar 2015 12:06:12
24995 0.047 x.i//2
24995 0.031 pos(right(x.i,1),02468)==0
24995 0.047 pos(right(x.i,1),13579)==0
24995 0.062 right(x2b(d2x(x.i)),1)
24995 0.031 Parse... ed.ld
24995 0.047 right... ed.ld
REXX-ooRexx_4.2.0(MT)_32-bit 6.04 22 Feb 2014 11 Mar 2015 12:06:00
25158 0.031 x.i//2
25158 0.031 pos(right(x.i,1),02468)==0
25158 0.047 pos(right(x.i,1),13579)==0
25158 0.093 right(x2b(d2x(x.i)),1)
25158 0.047 Parse... ed.ld
25158 0.031 right... ed.ld
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel