× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Steve Richter wrote:

well I just had to test this ( comparing a count to a 31 digit packed
decimal hival number seems a bit wasteful ) ...

the following million iteration loop runs for 63 milliseconds on a 170/2386
( 400+ cpw ):
...

and this do *hival version runs for 390 milliseconds
...


-Steve


So this means that in a loop that does nothing, a DOW loop is preferable to DO *HIVAL. In practice, most loops do a bit more than that, and so the difference in loop overhead is usually swamped by the operations within the loop.


But the comparison itself is flawed. The former uses a 10I0 variable as loop index, the latter uses an implicitly defined decimal variable with a precision of 31 digits. To make the comparison fair, define IX as 31P0 in the first program.

Out of curiosity, let's examine this result further. For the latter program, "DO *HIVAL" runs about 3 million iterations per second. If we let the program run for *HIVAL iterations, how long will we have to wait for the loop to end? My calculations show we'll have to wait, oh, about a hundred million billion years. ;-)

Cheers! Hans



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.