time bif

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

time bif

christel.u.w.pachl christel.u.w.pachl
Can this be done in NetRexx:
Call time 'R'
code
Say time('E')
and if so, how?
Thanks
Walter

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: time bif

Kermit Kiser
Looks like you are trying to measure elapsed time in a program.

Here is an excerpt from one of my programs showing how I did something
like that: (not guaranteed to be the best way :-)
-----------------------------------------------------------------------------------------
numeric digits 50

start=Date Date()
say 'Start translation' start
say ''

setup(arg)  --  1st parse operands, open files, init variables

loadmods    --  2nd load modification file:

loadbible   --  3rd load Bible into memory

endloads=Date Date()
say 'Loading complete.' endloads
say (endloads.getTime-start.getTime)/1000 'seconds elapsed'
-----------------------------------------------------------------------------------------
I hope that helps.

-- Kermit


On 7/21/2012 11:03 PM, Walter Pachl wrote:

> Can this be done in NetRexx:
> Call time 'R'
> code
> Say time('E')
> and if so, how?
> Thanks
> Walter
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: time bif

christel.u.w.pachl christel.u.w.pachl
In reply to this post by christel.u.w.pachl christel.u.w.pachl
Thanks!
works like a charm
Have a nice Sunday!

However, you shouldn't have told me :-)
See http://rosettacode.org/wiki/Talk:Sieve_of_Eratosthenes#NetRexx_Performance_.3F.3F

Regards
Walter

---- Kermit Kiser <[hidden email]> schrieb:

> Looks like you are trying to measure elapsed time in a program.
>
> Here is an excerpt from one of my programs showing how I did something
> like that: (not guaranteed to be the best way :-)
> -----------------------------------------------------------------------------------------
> numeric digits 50
>
> start=Date Date()
> say 'Start translation' start
> say ''
>
> setup(arg)  --  1st parse operands, open files, init variables
>
> loadmods    --  2nd load modification file:
>
> loadbible   --  3rd load Bible into memory
>
> endloads=Date Date()
> say 'Loading complete.' endloads
> say (endloads.getTime-start.getTime)/1000 'seconds elapsed'
> -----------------------------------------------------------------------------------------
> I hope that helps.
>
> -- Kermit
>
>
> On 7/21/2012 11:03 PM, Walter Pachl wrote:
> > Can this be done in NetRexx:
> > Call time 'R'
> > code
> > Say time('E')
> > and if so, how?
> > Thanks
> > Walter
> >
> > _______________________________________________
> > Ibm-netrexx mailing list
> > [hidden email]
> > Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
> >
> >
> >
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: time bif

Kermit Kiser
You did not ask if that was an efficiently written program. (It isn't.)

-- Kermit

On 7/22/2012 12:30 AM, Walter Pachl wrote:

> Thanks!
> works like a charm
> Have a nice Sunday!
>
> However, you shouldn't have told me :-)
> See http://rosettacode.org/wiki/Talk:Sieve_of_Eratosthenes#NetRexx_Performance_.3F.3F
>
> Regards
> Walter
>
> ---- Kermit Kiser <[hidden email]> schrieb:
>> Looks like you are trying to measure elapsed time in a program.
>>
>> Here is an excerpt from one of my programs showing how I did something
>> like that: (not guaranteed to be the best way :-)
>> -----------------------------------------------------------------------------------------
>> numeric digits 50
>>
>> start=Date Date()
>> say 'Start translation' start
>> say ''
>>
>> setup(arg)  --  1st parse operands, open files, init variables
>>
>> loadmods    --  2nd load modification file:
>>
>> loadbible   --  3rd load Bible into memory
>>
>> endloads=Date Date()
>> say 'Loading complete.' endloads
>> say (endloads.getTime-start.getTime)/1000 'seconds elapsed'
>> -----------------------------------------------------------------------------------------
>> I hope that helps.
>>
>> -- Kermit
>>
>>
>> On 7/21/2012 11:03 PM, Walter Pachl wrote:
>>> Can this be done in NetRexx:
>>> Call time 'R'
>>> code
>>> Say time('E')
>>> and if so, how?
>>> Thanks
>>> Walter
>>>
>>> _______________________________________________
>>>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: time bif

ThSITC
In reply to this post by christel.u.w.pachl christel.u.w.pachl
Am 22.07.2012 08:03, schrieb Walter Pachl:
Import org.netrexx..thsitc.runtime.compatibility
class main uses RexxTime
...
time('R')
...
say time('E')

*or:*, without the uses clause:
import og.netrexx.thsitc.runtiime.compatibility

RexxTime.time('R')

say RexxTime.time('E')

-- providing all those Rexx-like funtions is the whole purpose of the
org.netrexx.thsitc.runtimecompatibility       package

donated to RexxLA approx. a year ago *OPEN SOURCE* under the ICU Licence!

Is an enhanced version of the former Rexx2Nrx.Rexx2RT package.

Don' yet kow whether Rene did make it availalable for DOWNLOAD from
or.netrexx, however,
and what the REXXLA plans are there ...

a I donated it to RexxLA, I'm *only maintaining it*, but RexxLA should
take care to
supply fro the DOWNLOADs, I think ...

Thomas.
=====================================================================
greetings,
Thomas.



.

> Can this be done in NetRexx:
> Call time 'R'
> code
> Say time('E')
> and if so, how?
> Thanks
> Walter
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>


--
Thomas Schneider CEO ThSITC IT Consulting KG Erdbergstr. 52-60/1/13 1030
Wien Austria, Europe Skype ID: Thomas.Schneider.Wien Member of the Rexx
Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's
Team (www.netrexx.org)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

A request ad Walter ... (Re: time bif

Rony G. Flatscher (wu-wien)
In reply to this post by christel.u.w.pachl christel.u.w.pachl
Hi Walter,

just a request to you.

On 22.07.2012 09:30, Walter Pachl wrote:
> Thanks!
> works like a charm
> Have a nice Sunday!
>
> However, you shouldn't have told me :-)
> See http://rosettacode.org/wiki/Talk:Sieve_of_Eratosthenes#NetRexx_Performance_.3F.3F
Personally I think that your findings are very interesting, however, I think Rosettacode in this
case is the wrong place to communicate the findings. It makes the NetRexx language (as the only
language on that page) look very bad.

If I had no clues about NetRexx, I would not look into it because of your comment! So my
(unsolicited!) request to you, Walter, would be to remove that comment from Rosettacode altogether!

Your comment is very interesting and important nevertheless, but the forum to communicate these
findings would be this NetRexx list. So posting your comment here, would ignite enough interest and
draw the attention to this particular NetRexx Rosettacode example. Kermit's answer indicates that
the timing problem you have been stressing has nothing to do with NetRexx per se, but with the
implementation of the algorithm in NetRexx. Therefore I think it is much more appropriate to alert
and to discuss this in this NetRexx list, where there are enough NetRexx programmers who might be
inclined to take a look at that particular NetRexx example, possibly enhancing it to remove this
timing and OOME problem.

Cheers

---rony

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: A request ad Walter ... (Re: time bif

christel.u.w.pachl christel.u.w.pachl
Done
and Rene suggested a retest (which I will perform in the evening)
But somone (Rene??) could post the result he gets!
Sorry for posting the bad news - but we aren't chicken, are we?

In general I miss more RexxLA support of my rosettacode activities
(except for Rick's efforts - THANKS!!!!)

Walter

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: A request ad Walter ... (Re: time bif

rvjansen
Walter,

I get 3.63 sec for hi=200000 on a 2.2GHZ macbook.
And  119 sec for hi=2000000 with a 1GB heap min/max

Tomorrow I will probably have some time to look into what it does and
to test on faster machines. And to produce a meaningless microbenchmark
with a higher score. I agree with Rony that this is very useful though,
and I am thankful that you are stirring this up.

best regards,

René.


On 2012-07-23 12:45, Walter Pachl wrote:

> Done
> and Rene suggested a retest (which I will perform in the evening)
> But somone (Rene??) could post the result he gets!
> Sorry for posting the bad news - but we aren't chicken, are we?
>
> In general I miss more RexxLA support of my rosettacode activities
> (except for Rick's efforts - THANKS!!!!)
>
> Walter
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: A request ad Walter ... (Re: time bif

christel.u.w.pachl christel.u.w.pachl
In reply to this post by Rony G. Flatscher (wu-wien)
Thank you for the good words!
Can you easily translate my Rexx code to Nrx?
should be easy!
I would try Tom's Rexx2nrx but I have no working copy.
Walter

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Reply | Threaded
Open this post in threaded view
|

Re: A request ad Walter ... (Re: time bif

ThSITC
In reply to this post by christel.u.w.pachl christel.u.w.pachl
Hi Walter, and all,

the inherent problem, as observe by my own activities, as well,is:

Mr. RexxLA President, Rene Vincent Jansn, is *only 1 human beeing* (as
we all are, hopefully   ...)

What the *whole RexxLA* organization is missing, is a proper *ORGANISATION*,
to put a product as *NetRexx* properly *on the potential MARKET*.

Many individauls, with lot's of activities (and a lot of effort involved
by each of them ...)

BUT:

NO CONCERTED approaches !

I am a muician, and Composer, by hobby, for sol long time:

Let be tell you something:

A BAND is a BAND is a BAND (Tautology, again!)

When not *PLAYING* ***together ***, bad music is the result (sorry to
say that :-()

Massa Thomas ;-)
====================================================================
Am 23.07.2012 12:45, schrieb Walter Pachl:

> Done
> and Rene suggested a retest (which I will perform in the evening)
> But somone (Rene??) could post the result he gets!
> Sorry for posting the bad news - but we aren't chicken, are we?
>
> In general I miss more RexxLA support of my rosettacode activities
> (except for Rick's efforts - THANKS!!!!)
>
> Walter
>
> _______________________________________________
> Ibm-netrexx mailing list
> [hidden email]
> Online Archive : http://ibm-netrexx.215625.n3.nabble.com/
>
>


--
Thomas Schneider CEO ThSITC IT Consulting KG Erdbergstr. 52-60/1/13 1030
Wien Austria, Europe Skype ID: Thomas.Schneider.Wien Member of the Rexx
Languge Asscociation (www.rexxla.org) Member of the NetRexx Developer's
Team (www.netrexx.org)

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/

Thomas Schneider, Vienna, Austria (Europe) :-)

www.thsitc.com
www.db-123.com
Reply | Threaded
Open this post in threaded view
|

Re: time bif

Kermit Kiser
In reply to this post by christel.u.w.pachl christel.u.w.pachl
Sorry I could not respond earlier - busy moving.

The original version of the Sieve code specified "binary" for the
program and the methods, which implies a need to optimize numeric
performance. That only makes sense as the example is an extensive
mathematical calculation. But then the author deliberately chooses not a
native data format but a Rexx object for the key program variable which
tracks primes. A Rexx object is a very sophisticated associative
database but is highly memory intensive and not very efficient for
numerical processing of this type.

I did indeed test a slightly modified version before responding to your
note. A cleaned up copy of that test code is below. It removes the
binary attributes to facilitate conversions and explicitly uses a native
boolean array to track the primes. It also removes the unneeded method
calls for each true/false set operation! The choice of an array which
requires integer indexes limits the scan range to 1->2**32 but that
covers the test cases you requested. Further optimizations are possible
such as removing the redundant calculation of the square of the index in
the main loops, but this version shows no significant time lapse on my
computer until the 2000000 case and even then I think it is a memory
issue rather than an implementation issue. Of course elapsed times
depend on the computer hardware as well. I think a multi-threaded
version would be interesting given that modern desktop computers are now
approaching the 8 core level!

-- Kermit

----------------------------------------------------------------------------------------------------------------------
options replace format comments java crossref savelog symbols

start=Date Date()
say 'Start SOE' start
say ''

parse arg loWatermark hiWatermark .
if loWatermark = '' | loWatermark = '.' then loWatermark = 1
if hiWatermark = '' | hiWatermark = '.' then hiWatermark = 200

do
   if \loWatermark.datatype('w') | \hiWatermark.datatype('w') then -
     signal NumberFormatException('arguments must be whole numbers')
   if loWatermark > hiWatermark then -
     signal IllegalArgumentException('the start value must be less than
the end value')

   seive = sieveOfEratosthenes(hiWatermark)
   primes = getPrimes(seive, loWatermark, hiWatermark).strip

   say 'List of prime numbers from' loWatermark 'to' hiWatermark 'via a
"Sieve of Eratosthenes" algorithm:'
   say '  'primes.changestr(' ', ',')
   say '  Count of primes:' primes.words
catch ex = Exception
   ex.printStackTrace
end

endloads=Date Date()
say 'SOE complete.' endloads
say (endloads.getTime-start.getTime)/1000 'seconds elapsed'

return

method sieveOfEratosthenes(hn = Rexx) public static returns boolean[]

     true=boolean 1
     false=boolean 0

     sv=boolean[hn+1]
     sv[1]=false

   ix = int
   jx = int

     loop ix=2 to hn
         sv[ix]=true
         end

   loop ix = 2 while ix * ix <= hn
     if sv[ix] then loop jx = ix * ix by ix while jx <= hn
       sv[jx] = false
       end jx
     end ix

   return sv

method getPrimes(seive = boolean[], lo = long, hi = long) private
constant returns Rexx

   primes = Rexx('')
   loop p_ = lo to hi
     if \seive[p_] then iterate p_
     primes = primes p_
     end p_

   return primes

-----------------------------------------------------------------------------------------------------------------------------

On 7/22/2012 2:44 AM, Walter Pachl wrote:

> could one come up with a 'performant' version?
> I dare not try Tom's rexx2nrx :-)
>
> ---- Kermit Kiser <[hidden email]> schrieb:
>> You did not ask if that was an efficiently written program. (It isn't.)
>>
>> -- Kermit
>>
>> On 7/22/2012 12:30 AM, Walter Pachl wrote:
>>> Thanks!
>>> works like a charm
>>> Have a nice Sunday!
>>>
>>> However, you shouldn't have told me :-)
>>> See http://rosettacode.org/wiki/Talk:Sieve_of_Eratosthenes#NetRexx_Performance_.3F.3F
>>>
>>> Regards
>>> Walter
>>>
>>> ---- Kermit Kiser <[hidden email]> schrieb:
>>>> Looks like you are trying to measure elapsed time in a program.
>>>>
>>>> Here is an excerpt from one of my programs showing how I did something
>>>> like that: (not guaranteed to be the best way :-)
>>>> -----------------------------------------------------------------------------------------
>>>> numeric digits 50
>>>>
>>>> start=Date Date()
>>>> say 'Start translation' start
>>>> say ''
>>>>
>>>> setup(arg)  --  1st parse operands, open files, init variables
>>>>
>>>> loadmods    --  2nd load modification file:
>>>>
>>>> loadbible   --  3rd load Bible into memory
>>>>
>>>> endloads=Date Date()
>>>> say 'Loading complete.' endloads
>>>> say (endloads.getTime-start.getTime)/1000 'seconds elapsed'
>>>> -----------------------------------------------------------------------------------------
>>>> I hope that helps.
>>>>
>>>> -- Kermit
>>>>
>>>>
>>>> On 7/21/2012 11:03 PM, Walter Pachl wrote:
>>>>> Can this be done in NetRexx:
>>>>> Call time 'R'
>>>>> code
>>>>> Say time('E')
>>>>> and if so, how?
>>>>> Thanks
>>>>> Walter
>>>>>
>>>>> _______________________________________________
>>>>>
>
>

_______________________________________________
Ibm-netrexx mailing list
[hidden email]
Online Archive : http://ibm-netrexx.215625.n3.nabble.com/