Re: COBOL myth busted, index versus subscript (MF on HP)



On Wed, 17 Oct 2007 12:24:09 -0700, Vivian <vsaegesser@xxxxxxxxxxx> wrote:

Very interesting test. For comparison purposes, I ran Robert's code
on our ancient mainframe (it's a very old slow box). Since I too was
curious about an array without an index defined, I created another
iteration of the test, to do the same 2 tests with an non-indexed
array. Here's my results:

NULL TEST 77
INDEX 93
SUBSCRIPT 150
SUBSCRIPT COMP-5 184
INDEX 1 52
SUBSCRIPT 1 118
SUBSCRIPT 1 COMP-5 154
NON-INDX 1 108
NON-INDEXED COMP-5 149

So it would appear on my box that an aligned index is fastest. But
interestingly, simply defining an index slows you down if you intend
to use a subscript. At least that's what happens on an MP3000.

So, Question, what is exit perform cycle? It gave me a compiler error
so I commented it out. Would that effect the results?

When I first ran the test, the null loop was empty. Micro Focus' optimizer was smart
enough to optimize it down to zero time. As a result, I had no measurement of loop
overhead to subtract. Exit perform cycle was added to make it go around the null loop
repeat-factor times. Since it was in the null loop's time, I had to add it to all the
other loops.

In your case, exit perform cycle was not necessary, so deleting it did not affect the
results.

I don't understand how defining an unused index could affect the speed of a subscripted
access. Can you compare generated code to see what the extra instruction does? What is
comp-5 and why is it slower?
.



Relevant Pages

  • rotate revisited
    ... Suppose we have an array A containing n equi-spaced elements. ... The cost of this method (excluding loop costs) is: ... Each cycle is of length n/d. ... I will use the term "small slide" for a data move that is less ...
    (comp.programming)
  • Re: [VB5) Faster way to read a text file?
    ... exceptions for raising error conditions with "proper" use of On ... I use Exit For semi-often, ... I've got an array that I am searching something for. ... why bother letting the loop run full if you ...
    (microsoft.public.vb.general.discussion)
  • Re: [VB5) Faster way to read a text file?
    ... for raising error conditions with "proper" use of On Error and/or ... I use Exit For semi-often, ... I've got an array that I am searching something for. ... they aren't really suggesting that one does let the "loop run full". ...
    (microsoft.public.vb.general.discussion)
  • Re: [VB5) Faster way to read a text file?
    ... What you've described is a very common usage of Exit For. ... would normally structure that with the equivalent While loop: ... While (Not blnFound) And ... I've got an array that I am searching something for. ...
    (microsoft.public.vb.general.discussion)
  • Re: compare 2 recordsets
    ... This made me think that maybe a double loop could be faster as you ... point and do exit do or exit loop when it has past the value. ... Another thing to try is using GetRows to put the rsParentNode data into an array - looping through an array is much quicker than looping through a recordset ...
    (microsoft.public.data.ado)