×
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.
I followed Barbara's advice and performed some testing over the weekend (a
V5R2 shareware machine which was very quiet when I ran my tests).
I will outline the tests and display the results. You may be surprised by
them - I certainly was.
Using the code posted by Barbara as a base I tested the following:
1) Passing a 1a literal to a 65535 varying parm (as posted by Barbara).
2) Passing a 65535a varying variable to a 65535 varying parm - variable
length 100a.
3) Passing a 65535a varying variable to a 65535 varying parm - variable
length 1000a.
4) Passing a 65535a varying variable to a 65535 varying parm - variable
length 65535a.
The values displayed are the average call time over a 10000 loop and all
tests were performed in the same run of the program. I ran the program 4
times to get a reasonable set of values.
The results are below (first column is value, second is const):
Passing the literal "a" (as per example)...
1596 ms 9 ms
1531 ms 8 ms
1543 ms 9 ms
1539 ms 9 ms
Passing a 65535a varying field with length 100...
1484 ms 8 ms
1483 ms 8 ms
1504 ms 8 ms
1486 ms 8 ms
Passing a 65535a varying field with length 1000...
1748 ms 8 ms
1682 ms 8 ms
1744 ms 8 ms
1680 ms 8 ms
Passing a 65535a varying field with length 65535...
2271 ms 8 ms
2211 ms 8 ms
2246 ms 8 ms
2219 ms 8 ms
Conclusions:
A) const is much faster than value.
B) Passing a 1a literal is actually more expensive than passing a 65535a
variable with length <1000.
C) When passing by value the operation takes longer the more we fill the
variable. Const seems to be unaffected.
Now, following from this I decided to test the common perception that using
varying fields is faster than fixed-length fields. So I ran the same test
for a 65535a field passed to a 65535a parm. The results are below:
Passing the literal _a_ for 65535a...
1963 ms 349 ms
1888 ms 337 ms
1928 ms 340 ms
1893 ms 337 ms
Passing a 65535a with 100a non-blanks filled...
1000 ms 8 ms
1009 ms 7 ms
1035 ms 8 ms
968 ms 7 ms
Passing a 65535a with 1000a non-blanks filled...
1046 ms 8 ms
971 ms 7 ms
984 ms 8 ms
967 ms 7 ms
Passing a 65535a with 65535a non-blanks filled...
967 ms 7 ms
966 ms 7 ms
967 ms 7 ms
967 ms 7 ms
Conclusions:
A) const is much faster than value.
B) Passing a 1a literal is more expensive than passing a 65535 variable with
length <1000.
C) Passing the 1a literal to a fixed-length parm is more expensive than to a
varying parm.
D) When passing a variable by value the fixed-length version was
significantly faster (at least 30%) than the varying equivalent. In the case
of passing a fully populated field the fixed-length version was more than
twice as fast.
E) When passing by constant reference the fixed-length version was at least
as fast as the varying version. In most cases it was faster.
Now, I can't draw any major conclusions here, but it is certainly
interesting. I re-ran a few tests on my work V5R4 machine this morning (time
permitting) and the gap between value and const was smaller. both were much
faster than on the V5R2 machine.
Hope this adds to the discussion.
(I can post the code if anybody else wants to benchmark on their machine)
Cheers
Larry Ducie
As an Amazon Associate we earn from qualifying purchases.
This thread ...
RE: Is const really that much better than value?, (continued)
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.