Hi all,

I wrote a loop timer script over the weekend. You can find it on the Ecotope
rebsite

http://www.nwlink.com/~ecotope1/reb/loop-timer.r

For an example, I used the script to examine the speed of simple looping and
block access constructs for the kind of tight loops often used in numeric
programming, vector-matrix operations, image processing, etc. The script is
easily rewritten to create timing tests for your own interests.

The example takes about 3 minutes to run at 450MHz, for slower machines you
can reduce the ITS variable.

My example results for Core and View/Pro (450MHz PII Win98) with some brief
comments are given in

http://www.nwlink.com/~ecotope1/reb/loop-times.txt

One interesting finding was that View is about 3% faster than Core.

Some excerpts from the example results are shown below.

Enjoy
-Larry

----------------------------------------------------
Loop Timer Test Results
View/Pro 1.1.0.3.1
Date: 5-May-2001/21:10:28-7:00
Block size: 10000 Loop its: 100

Time   Loop Source Code

Empty loops

0.11   [loop sz []]
0.11   [repeat j sz []]
0.17   [foreach el x []]
2.21   [j: 1 while [j <= sz] [j: j + 1]]
5.27   [for j 1 sz 1 []]
6.92   [forall x [] x: head x]
7.92   [forskip x 1 [] x: head x]

Set and reset current series index

2.42   [loop sz [x: tail x x: head x]]

Access all elements of block

0.61   [foreach el x [s: el]]
1.65   [repeat j sz [s: pick x j]]
1.86   [repeat j sz [s: x/:j]]
2.37   [loop sz [s: first x x: next x] x: head x]
2.80   [j: 1 loop sz [s: pick x j j: j + 1]]
4.23   [while [not tail? x] [s: first x x: next x] x: head x]
7.31   [for j 1 sz 1 [s: pick x j]]
8.63   [forall x [s: first x] x: head x]
9.39   [forskip x 1 [s: first x] x: head x]

Sum elements of block of numbers

1.53   [s: 0 foreach el x [s: s + el]]
2.53   [s: 0 repeat j sz [s: s + pick x j]]
3.85   [s: 0 j: 1 loop sz [s: s + pick x j j: j + 1]]
3.79   [s: 0 loop sz [s: s + pick x 1 x: next x] x: head x]
8.23   [s: 0 for j 1 sz 1 [s: s + pick x j]]
10.06   [s: 0 forall x [s: s + first x] x: head x]

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to