Re: Cobol Myth Busters



On Mon, 03 Sep 2007 13:26:53 -0300, Clark F Morris <cfmpublic@xxxxxxxxxxxxxxx> wrote:

On Fri, 31 Aug 2007 21:22:35 -0500, Robert <no@xxxxxx> wrote:

Test:
05 display-number pic 9(09).
05 packed-number comp-3 pic s9(09).

add 1 to display-number *> 174 us
add 1 to packed-number *> 160 us

Finding: CONFIRMED. Packed is almost as slow as display. It was fast on 1970-era
mainframes. There is no longer any reason to use it. If you want to save space, look at
space-filled strings and filler-padding.

There may be other good reasons to go to display but if you are using
a z series computer (latest evolution of the IBM 360), packed decimal
is still faster than display.

I would expect binary to be the fastest on a z series, as it is on every other computer.

Most results depend on the computer architecture.

The program shouldn't be tied to a specific machine, especially when the feature is out of
step with industry norms. Doing so locks users into one manufacturer, which is contrary to
the spirit of high level languages.

I suspect in answer to your next question that
alignment still matters on some currently sold computers with an
architecture different from the ones tested on.

Yes, some CPUs don't require alignment e.g. IBM, Motorola, Intel 16/32 bit. Some throw an
exception and expect the operating system to handle it in software (expensively)
i.e.IA-64, most RISC machines including PA, PowerPC and Alpha. A few operating systems
abort the process when they get a misalignment fault e.g. old Apple.

Micro Focus' use of IBMCOMP for the compiler option that turns on memory boundary
awareness gives the impression that is (or was) a concern in the IBM mainframe world. Not
in my experience. I've never seen a mainframe, IBM or other, throw a fault for
misalignment. It doesn't seem appropriate for ANY machine with an L2 cache to do so. I
wrote the speed program primarily to test whether a modern PA processor (88xx/89xx, which
have L2) is slowed down by misalignment, secondarily to disprove (or not) Cobol myths
such as ODO being slow and demonstrate real inefficiencies such as packed decimal.

FWIW, IBM coined the word cache in the context of memory in 1967. The S/360 model 85 was
probably the first computer to use memory cache.
http://en.wikipedia.org/wiki/Memory_cache

.