Path: utzoo!yunexus!geac!john From: john@geac.UUCP (John Henshaw) Newsgroups: comp.arch Subject: Re: taken -vs- untaken branches, Fortran FREQUENCY declaration Summary: Let the compiler do it! Here's how? Message-ID: <2158@geac.UUCP> Date: 22 Jan 88 15:25:59 GMT Article-I.D.: geac.2158 Posted: Fri Jan 22 10:25:59 1988 References: <839@ima.ISC.COM> Reply-To: john@geac.UUCP (John Henshaw) Organization: The little blue rock next to that twinkly star. Lines: 42 In article <839@ima.ISC.COM> johnl@ima.UUCP (John R. Levine) writes: > >It seems to me that in most cases static analysis by the compiler can figure >out which is the preferred direction, e.g. branches that close loops are >likely to be taken. In the cases where that doesn't work, I'd expect profiling >and recompiling to produce far better hints that a typical programmer would >put in. >-- >John R. Levine I endorse this point of view, and wonder if there are compilers available that insert profiling logic that maintain a comprehensive history of branch activity, followed by recompilation that takes into account the previous branch history. The activity of producing a piece of production code would be: 1. Design, code and test your program. 2. Compile it for "branch profiling". 3. Execute the program on a dataset large enough that there is sufficient confidence that the program's execution is truly representative of "standard production activity". 4. Recompile the program. This recompilation should use the information gained from step 3. There are a few assumptions here :-). I think they're obvious. Most of the intent here is to not have programmers guess about program activity, but rather have the compiler/profiler do this analysis for him/her. There is the known concern that the data will change, causing worse performance than anticipated - steps 2 to 4 should probably be rerun from time to time. And of course there are times when we wish to optimize the exception conditions because they're the reason for automation in the first place. Comments anyone? -john- -- John Henshaw, (mnetor, yetti, utgpu !geac!john) Geac Computers Ltd. "Relax. The collapse of the universe and all Markham, Ontario, Canada, eh? life as we know it, could only kill you once."