Python and COBOL

François Pinard pinard at iro.umontreal.ca
Mon Aug 28 20:15:35 EDT 2000


[John W. Baxter]

> [François Pinard]

> Hmmm...I would have expected a CDC shop to use Fortran for that.

Oh, the PPU code was routinely generated on an IBM-370, and moved over to
the CDC-machine for compilation and installation.

> (The CDC Fortran was wonderous to behold.  In one test, a decent Fortran
> programmer and a top-drawer assember programmer were assigned the same
> non-trivial program to write.  [...]

I remember having spent three full days optimising about 25 lines of CPU
assembler (yet I also remember, many years after, that I was very tired).
It was the chore of a relocating loop for a LISP loader a friend and I were
writing, and the idea was to be able to fully process the tables at least
as fast as they were delivered from disk by the PPU.  Some might remember
all attention that was given, at the time, to not loose disk revolutions.

The problems to ponder, for a good assembler coder, were to keep busy as many
arithmetic units as simultaneously possible, to resolve register allocation
conflicts (three types for them) that would prevent the scoreboard from
issuing instructions, to tighten loops enough so they fit in the small
instruction stack, to minimise the number of no-ops for realigning jump
goals, to re-equilibrate code between jumps and flow through tests so RNI
is more efficient, to properly "wrap" code around the entry/exit point.
Maniacs were considering memory bank conflicts, but this, I usually did not.

The FTN compiler was taking care of many of these tasks automatically, and
was also generating clever code in many circumstances, often to minimise
the number of conditional jump instructions and to normalise arithmetic.

Very few people considered or praised the other compilers, but I guess
I studied the code generated by everything available.  Nobody knows how
absolutely clever the COBOL compiler was at doing decimal arithmetic,
on a machine not meant for that.  So clever, in fact, that I wondered if
Seymour Cray did not know it all in advance when he designed the machine.
The Pascal compiler, later, was astonishingly sharp generating code avoiding
multiplications and divisions, especially while indexing packed structures.

When I see myself programming Python, nowadays, and caring so little about
CPU cycles, I sometimes feel I lived many lives :-).

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard




More information about the Python-list mailing list