Wonders of IBM's REXX compiler 
Author Message
 Wonders of IBM's REXX compiler

Nice try, but when I compile this code, which is
functionally equivalent :

  NUMERIC DIGITS 20000
  N =  9999
  A =  2**N-1
  N =  5555
  B =  2**N+1
  SAY A//B

it runs in the same 0.50 CPU seconds !
(I would be surprised the expression be resolved earlier,
at compile time !).
I can't understand how they do it.
I am curious to know how IBM achieves this
(because in pure assembler I am unable to get the same performance).
I am cross-posting this message to other groups...

Quote:

>My guess is that the compiler is resolving the expression at compile time,
so
>the only thing  REXX needs to do at execution time is 'say' the  resolved
>expression.


>> My REXX exec consists of 2 lines :

>>  NUMERIC DIGITS 20000
>>  SAY (2**9999-1)//(2**5555+1)     /* LONG RUNNING STATEMENT */

>> When I run it in interpreted mode, it takes 50 CPU seconds
>> (on a old, tired P/390).

>> When I compile it with IBM's REXX compiler, it runs in 0.50 CPU seconds
!!
>> (on the same old, tired P/390).

>> Any idea why the compiled code is 100 times more efficient ?
>> (letting apart it is compiled...)

>> http://www.*-*-*.com/
>> Is there life after MVS ?



Tue, 01 Oct 2002 03:00:00 GMT  
 Wonders of IBM's REXX compiler
On Fri, 14 Apr 2000 20:52:25 +0200, "Thierry FALISSARD"

Quote:

>I am curious to know how IBM achieves this
>(because in pure assembler I am unable to get the same performance).

Well, REXX is a pretty remarkable language....   ;-)


Tue, 01 Oct 2002 03:00:00 GMT  
 Wonders of IBM's REXX compiler

Quote:

> Nice try, but when I compile this code, which is
> functionally equivalent :

>   NUMERIC DIGITS 20000
>   N =  9999
>   A =  2**N-1
>   N =  5555
>   B =  2**N+1
>   SAY A//B

> it runs in the same 0.50 CPU seconds !
> (I would be surprised the expression be resolved earlier,
> at compile time !).
> I can't understand how they do it.
> I am curious to know how IBM achieves this
> (because in pure assembler I am unable to get the same performance).
> I am cross-posting this message to other groups...

Note that the compiler should be quite able to evaluate this
entire expression at compile time (either way you express
it) - it's fundamentally a constant.

So, the only real result of this compilation is to invoke
the run-time SAY routine with the right argument.
There is no computation to do.

The interpreter, however, has to evaluate the expression,
and thus consumes more time.

    - Dave Rivers -

- Show quoted text -

Quote:


> >My guess is that the compiler is resolving the expression at compile time,
> so
> >the only thing  REXX needs to do at execution time is 'say' the  resolved
> >expression.


> >> My REXX exec consists of 2 lines :

> >>  NUMERIC DIGITS 20000
> >>  SAY (2**9999-1)//(2**5555+1)     /* LONG RUNNING STATEMENT */

> >> When I run it in interpreted mode, it takes 50 CPU seconds
> >> (on a old, tired P/390).

> >> When I compile it with IBM's REXX compiler, it runs in 0.50 CPU seconds
> !!
> >> (on the same old, tired P/390).

> >> Any idea why the compiled code is 100 times more efficient ?
> >> (letting apart it is compiled...)

> >> http://os390-mvs.hypermart.net
> >> Is there life after MVS ?

--

Get your mainframe (370) `C' compiler at http://www.dignus.com


Tue, 01 Oct 2002 03:00:00 GMT  
 Wonders of IBM's REXX compiler
Again, I insist, if  I PULL the values for N so that there are
not known at compile time (Doug Nadel suggested it), the
CPU time is the same. So the compiler must undoubtedly
implement a very efficient calculation. I wonder why a similar
code is not used when in interpreted mode. The wonders of REXX...

Thomas David Rivers wrote

Quote:

>> Nice try, but when I compile this code, which is
>> functionally equivalent :

>>   NUMERIC DIGITS 20000
>>   N =  9999
>>   A =  2**N-1
>>   N =  5555
>>   B =  2**N+1
>>   SAY A//B

>> it runs in the same 0.50 CPU seconds !
>> (I would be surprised the expression be resolved earlier,
>> at compile time !).
>> I can't understand how they do it.
>> I am curious to know how IBM achieves this
>> (because in pure assembler I am unable to get the same performance).
>> I am cross-posting this message to other groups...

>Note that the compiler should be quite able to evaluate this
>entire expression at compile time (either way you express
>it) - it's fundamentally a constant.

>So, the only real result of this compilation is to invoke
>the run-time SAY routine with the right argument.
>There is no computation to do.

>The interpreter, however, has to evaluate the expression,
>and thus consumes more time.

>    - Dave Rivers -


>> >My guess is that the compiler is resolving the expression at compile
time,
>> so
>> >the only thing  REXX needs to do at execution time is 'say' the
resolved
>> >expression.


>> >> My REXX exec consists of 2 lines :

>> >>  NUMERIC DIGITS 20000
>> >>  SAY (2**9999-1)//(2**5555+1)     /* LONG RUNNING STATEMENT */

>> >> When I run it in interpreted mode, it takes 50 CPU seconds
>> >> (on a old, tired P/390).

>> >> When I compile it with IBM's REXX compiler, it runs in 0.50 CPU
seconds
>> !!
>> >> (on the same old, tired P/390).

>> >> Any idea why the compiled code is 100 times more efficient ?
>> >> (letting apart it is compiled...)

>> >> http://os390-mvs.hypermart.net
>> >> Is there life after MVS ?

>--

>Get your mainframe (370) `C' compiler at http://www.dignus.com



Wed, 02 Oct 2002 03:00:00 GMT  
 Wonders of IBM's REXX compiler

Quote:

> So the compiler must undoubtedly
> implement a very efficient calculation.

Perhaps it is an optimization based on the fact that A=2**N
can be optimized by shifting a one-bit N bits, as long as the
exponent is an integer. The remaining calculations ar much
simpler and account for the half-second cpu usage.

Regards, Johnnie



Wed, 02 Oct 2002 03:00:00 GMT  
 Wonders of IBM's REXX compiler

Quote:

>Nice try, but when I compile this code, which is
>functionally equivalent :

>  NUMERIC DIGITS 20000
>  N =  9999
>  A =  2**N-1
>  N =  5555
>  B =  2**N+1
>  SAY A//B

>it runs in the same 0.50 CPU seconds !
>(I would be surprised the expression be resolved earlier,
>at compile time !).
>I can't understand how they do it.
>I am curious to know how IBM achieves this
>(because in pure assembler I am unable to get the same performance).
>I am cross-posting this message to other groups...


>>My guess is that the compiler is resolving the expression at compile time,
>so
>>the only thing  REXX needs to do at execution time is 'say' the  resolved
>>expression.


>>> My REXX exec consists of 2 lines :

>>>  NUMERIC DIGITS 20000
>>>  SAY (2**9999-1)//(2**5555+1)     /* LONG RUNNING STATEMENT */

>>> When I run it in interpreted mode, it takes 50 CPU seconds
>>> (on a old, tired P/390).

>>> When I compile it with IBM's REXX compiler, it runs in 0.50 CPU seconds
>!!
>>> (on the same old, tired P/390).

>>> Any idea why the compiled code is 100 times more efficient ?
>>> (letting apart it is compiled...)

>>> http://os390-mvs.hypermart.net
>>> Is there life after MVS ?

Rexx interpreted bignum arithmetic is unfortunately very slow -- at least
in the S/370 versions I'm familiar with.  So the compiled code (which I
presume is capable of keeping track of the effective datum type of vars)
doesn't need superhuman efforts to beat interpreted code in this case.

I compared interpreted Rexx performance to an equivalent EXEC 2 program
(using a private version of EXEC 2 that supports integer bignums, i.e. one
that simply removes range restrictions from integers and length restrictions
from variable names and values, with (essentially) no language change), and
found that the EXEC 2 version ran 80 times faster than the Rexx version
on two machines where I tried it -- despite the fact that EXEC 2 has no
built-in power operator, and I had to use a user-defined function -POW OF
(which implemented the same square-or-multiply algorithm as Rexx uses).

(On a G5 mainframe, Rexx took 1.8s and EXEC 2 took 25 ms to generate the
same 1673-digit result; on a 9121 the times were 11s vs 125ms.)

I'm tempted to try out a built-in &POWER OF function to see what difference
that would make.  I did time the power and remainder functions separately,
and found that the two power operations together accounted for slightly more
than 50% of the time (the remainder operation took the rest) -- so it is
conceivable that I could squeeze another factor of two out of it, in which
case the ratio of EXEC 2 vs Rexx would exceed the claimed ratio between
compiled and interpreted Rexx.  (Should I try it?)

Michel



Fri, 04 Oct 2002 03:00:00 GMT  
 Wonders of IBM's REXX compiler
Yall

Consider that the code is only being optimized because of the instruction
pipelining and chaining of the IBM REXX compiler. If you alter the code to
introduce W/RAW dependencies such as

A =  9999
A =  2**A-1
B =  5555
B =  2**B+1
SAY A//B

This should eliminate the pipelining algorithm hence removing the
optimization and the code should now run much slower ...

Andre


Quote:
> Again, I insist, if  I PULL the values for N so that there are
> not known at compile time (Doug Nadel suggested it), the
> CPU time is the same. So the compiler must undoubtedly
> implement a very efficient calculation. I wonder why a similar
> code is not used when in interpreted mode. The wonders of REXX...

> Thomas David Rivers wrote

> >> Nice try, but when I compile this code, which is
> >> functionally equivalent :

> >>   NUMERIC DIGITS 20000
> >>   N =  9999
> >>   A =  2**N-1
> >>   N =  5555
> >>   B =  2**N+1
> >>   SAY A//B

> >> it runs in the same 0.50 CPU seconds !
> >> (I would be surprised the expression be resolved earlier,
> >> at compile time !).
> >> I can't understand how they do it.
> >> I am curious to know how IBM achieves this
> >> (because in pure assembler I am unable to get the same performance).
> >> I am cross-posting this message to other groups...

> >Note that the compiler should be quite able to evaluate this
> >entire expression at compile time (either way you express
> >it) - it's fundamentally a constant.

> >So, the only real result of this compilation is to invoke
> >the run-time SAY routine with the right argument.
> >There is no computation to do.

> >The interpreter, however, has to evaluate the expression,
> >and thus consumes more time.

> >    - Dave Rivers -


> >> >My guess is that the compiler is resolving the expression at compile
> time,
> >> so
> >> >the only thing  REXX needs to do at execution time is 'say' the
> resolved
> >> >expression.


> >> >> My REXX exec consists of 2 lines :

> >> >>  NUMERIC DIGITS 20000
> >> >>  SAY (2**9999-1)//(2**5555+1)     /* LONG RUNNING STATEMENT */

> >> >> When I run it in interpreted mode, it takes 50 CPU seconds
> >> >> (on a old, tired P/390).

> >> >> When I compile it with IBM's REXX compiler, it runs in 0.50 CPU
> seconds
> >> !!
> >> >> (on the same old, tired P/390).

> >> >> Any idea why the compiled code is 100 times more efficient ?
> >> >> (letting apart it is compiled...)

> >> >> http://os390-mvs.hypermart.net
> >> >> Is there life after MVS ?

> >--

> >Get your mainframe (370) `C' compiler at http://www.dignus.com



Fri, 25 Oct 2002 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Ada compiler for IBM-AT's ('286)

2. REXX compiler or syntax checker for IBM PC??

3. IBM-Rexx (Mainframe) Compilers

4. IBM Compiler and Library for REXX on zSeries Release 4 increase efficiency and flexibility

5. REXX 'compiler'

6. similar function to ibm's RXQUEUE.EXE in REGINA REXX

7. Object Rexx problems with cgi's when using IBM internet connection server

8. Scheme compiler for IBM PC's

9. Performance of various data types (IBM's latest mainframe compiler)

10. ADA Compiler for IBM-PC's

11. IBM's Fortran compiler for OS2

12. VA's table --wondering how

 

 
Powered by phpBB® Forum Software