Re: Perform Thru/Go to vs. Perform - Compile Speed

From: Jeff Lanam (jeff-dot-lanam_at_hp-dot-com-not.net)
Date: 04/28/04


Date: Tue, 27 Apr 2004 22:37:24 GMT

On Mon, 26 Apr 2004 17:57:59 -0500, LX-i <lxi0007@netscape.net> wrote:

>Good evening (or morning, afternoon, or night)...
>
>We've seen something strange at work and I thought I'd ask for
>experienced opinions. We had a program that was a maze of Perform Thru
>and Go to loops - we printed it out, put Ragu on it, and we all had lunch!
>
>Anyway, one of our programmers untangle the mess, and ended up with a
>very structured program that utilized Perform exclusively, except to "Go
>to" the ending paragraph. The program compiled noticeably faster, with
>an equivalent load on the machine both times.

My guess is that in the old code, the compiler was spending a lot of
time doing control flow analysis. Most code generators build a
directed acyclic graph of the basic blocks of the program and try to
figure out the flow of execution through the program, to do
optimizations. PERFORM THRUs, particular if they overlap, make for a
messy graph. Structured code is easier to optimize. Probably runs
faster, too.
Jeff Lanam HP NonStop COBOL Project INCITS/J4
NonStop Enterprise Division
Hewlett-Packard