Re: "Shared" procedure division code
- From: "Oliver Wong" <owong@xxxxxxxxxxxxxx>
- Date: Thu, 21 Jul 2005 13:32:20 GMT
"William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx> wrote in message
news:T9ADe.499087$3V6.422305@xxxxxxxxxxxxxxxxxxxxxxxxx
> As a follow up on another thread ....
>
> It seems to me that the most common place where I *used* to see the same
> source code (paragraph/section) repeated within a single program was in
> OLDER (IBM) CICS code where "locality of code" was an issue. That was
> that it was important that the application not need to "page in and out"
> sections of machine code depending upon application logic flow. Although
> this is still a MINOR consideration in that (and possibly other)
> environments, I don't know where it happens with NEW code today.
With regard to "new code" (and not nescessarily just COBOL, but for
programming in genenral), the advice I typically hear is don't try to
outsmart the compiler. Rather, one should write their code in such a way as
to make it as easy to understand as possible so that the compiler itself can
figure out what you're trying to do, and optimize appropriately (of course,
this assumes you're programming in some language for which code analysis is
easier ;)).
A lot of people who claim to optimize don't bother to actually profile
their code to find out what parts of the program are running slowly, or even
whether or not their "optimizations" haven't actually made the program run
MORE slowly.
If it turns out you ARE smarter than the compiler, you should contribute
your ideas to the compiler developers (this is easier if you're using an
open source compiler), so that you can then write your code clearly, and
still have it perform just as fast as had you optimized it directly.
The only situations I can think of where it might be desirable to do
manual optimizations is for environments where the compilers haven't matured
enough to actually accept optimization contributions even if you had them
(e.g. compilers for cell phone, or "smart refrigerators", and things that
have only recently become programmable).
- Oliver
.
- References:
- "Shared" procedure division code
- From: William M. Klein
- "Shared" procedure division code
- Prev by Date: Re: Is it always possible to write a COBOL program using only 1 sentence per paragraph?
- Next by Date: Re: Is it always possible to write a COBOL program using only 1 sentence per paragraph?
- Previous by thread: "Shared" procedure division code
- Next by thread: Re: "Shared" procedure division code
- Index(es):
Relevant Pages
|