× 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.



Bob Cozzi wrote:
Hans,
I do remember Dick Bains complaining when they implemented XLATE in RPGIII
as to how poorly it performed. So %SCAN over and over again would be faster?
Hmmm, maybe going further and using memchr() would even be better?
-Bob


Bob: If you're concerned about performance, then you need to do some performance testing on the alternatives, using representative samples of expected data. But in this case, comparing the performance of XLATE in RPG III versus XLATE or %XLATE in RPG IV is meaningless.


At any rate, when the "from" or "to" argument of %XLATE is a variable, generally, RPG IV dynamically builds a translate table which is used to perform the translation. So, you're performing several loops over the operands.

Perhaps using XLATE (or %XLATE) might be better than using %SCAN within the filter loop for certain classes of date, perhaps not. But which you choose depends on lots of different (possibly conflicting) factors. If performance is important, then you might choose one particular implementation after lots of rigorous performance testing on representative data (worst case, best case, average case, etc.). If readability and maintainability of the code is important, then a different implementation may be more appropriate.

Anyways, I still stand by my recommendations. I think it's easier to maintain, and my gut tells me it's probably faster than using XLATE. And even if it isn't faster, the difference probably isn't worth fretting over.

Cheers! Hans


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.