|
%len(%trimr()) vs %checkr: I changed this program to run in loop 100,000 times using %len(%trimr()) first and then %checkr(). Just like Albert has mentioned, %checkr is about 30% faster:
%len(%trimr()) version took about 31 Secs for 100,000 loops
DSPLY (%trimr - Start at 2010-02-25-09.53.57.193000
DSPLY %trimr - Ended at 2010-02-25-09.54.28.624000
%checkr() version took about 21 Secs for 100,000 loops
DSPLY %checkr Start at 2010-02-25-09.54.56.119000
DSPLY %checkr Ended at 2010-02-25-09.55.16.412000
"hockchai Lim" <lim.hock-chai@xxxxxxxxxxxxxxx> wrote in message news:mailman.11043.1267111582.2580.rpg400-l@xxxxxxxxxxxxxxx
It is hard for me to imagine an iseries takes more than two mins to do this operation 5012 times. I wrote a test program and ran it under the worst case senario (where s has a value of 'a'). Execute this operation 5012 times only took 2 secs on our test system. Can you try this?
D s s 18462 inz('a')
D sLen s 5i 0
D ix s 5i 0
D msg s 52
/free
msg = 'Start at ' + %char(%timestamp);
dsply msg;
for ix = 1 to 5012;
sLen = %len(%trimr(s));
endfor;
msg = 'Ended at ' + %char(%timestamp);
dsply msg;
*inlr = *on;
/end-free
"James H. H. Lampert" <jamesl@xxxxxxxxxxxxxxxxx> wrote in message news:mailman.10896.1267054104.2580.rpg400-l@xxxxxxxxxxxxxxx
Albert York wrote:
In my tests, CHECKR performed at least 30% better than %len(%trimr(s))Definitely something to keep in mind, for cases where I can't simply calculate the value, based on the lengths of what went into the field.
At any rate, calculating the value, rather than calling %LEN(%TRIMR()) cut processing time per record by about 31 milliseconds out of a total of about 55 milliseconds. Or in more concrete terms, the time to process and deliver 5012 records dropped from over 4 1/2 minutes to about 2, running on a 170.
Thanks to all who had anything to say.
--
JHHL
As an Amazon Associate we earn from qualifying purchases.
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.