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



+1

Gary Cornell, another author of lots of programming books a few years ago, had 3 rules of optimization -

1. Don't!
2. Don't!
3. Don't!

One main reason is that most optimization requires tricky, "cute" code that is hard to maintain.

OK, I'll go hide in my corner again!

Vern

On 10/7/2019 3:36 PM, Barbara Morris wrote:
On 2019-10-07 1:15 AM, Javier Sánchez wrote:
...
In general, when declaring variables in RPG nevertheless kind of, try to
always give it a size compatible with a binary equivalent to at least a
16-byte-multiple size.

For example, if you want to declare a variable as CHAR(10), consider giving
it a size of either CHAR(8) or CHAR(16).  Let me tell you, the RPG compiler
won't let you know it, but it would very much like to do it, that you did a
smart decision if you did so.

Give stand-alone variables sizes that are multiple of 4-, 8-, 16-, or
32-bit sizes.   In terms of performance, you will get a reward.
...

I don't agree with this advice.

Remember what Donald Knuth said: "Premature optimization is the root of all evil".

Defining all your variables so their size is a multiple of 4 would make it very difficult to actually write your code correctly. If you want a character field with a length of 10, I think you should define it with a length of 10. Let the optimizer handle the optimization.



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.