Path: utzoo!utgpu!water!watmath!clyde!rutgers!cmcl2!nrl-cmf!ames!pasteur!ucbvax!ucsfcgl!cca.ucsf.edu!ccb.ucsf.edu!dick From: dick@ccb.ucsf.edu (Dick Karpinski) Newsgroups: comp.arch Subject: Re: FREQUENCY statements: fill a much-needed gap Summary: programmers are wrong Message-ID: <1136@ucsfcca.ucsf.edu> Date: 19 Jan 88 21:09:10 GMT References: <839@ima.ISC.COM> <28200085@ccvaxa> <1267@winchester.UUCP> <2861@clash.rutgers.edu> Sender: root@cca.ucsf.edu Reply-To: dick@ucsfccb.UUCP (Dick Karpinski) Organization: UCSF Computer Center Lines: 26 In article <2861@clash.rutgers.edu> segall@clash.rutgers.edu (Ed Segall) writes: >Yes, it it true that profiling (with appropriate input data, for >programs with data-dependent profiles) is the best way to do this. >However, predicting the most likely branch is not the only reason ... > >I think the missle example showed it best (to paraphrase: you don't >want to optimize for the most common case, when no missles are coming >in. You'd be better off optimizing the very uncommon case when they >are). Computer programs exhibit unexpected behavior very often. Even in this odd missle case, I would rather try to simulate the environment in which the missles are coming and instruct the compiler to respect the observed frequencies rather than expect the programmer to guess correctly. For example, it may well be that the usual case is still the usual case even when the missles are in view. Only a well designed optimiser can be expected to do a good job. People are seldom much like well designed optimisers. Dick Dick Karpinski Manager of Minicomputer Services, UCSF Computer Center UUCP: ...!ucbvax!ucsfcgl!cca.ucsf!dick (415) 476-4529 (11-7) BITNET: dick@ucsfcca or dick@ucsfvm Compuserve: 70215,1277 USPS: U-76 UCSF, San Francisco, CA 94143-0704 Telemail: RKarpinski Domain: dick@cca.ucsf.edu Home (415) 658-6803 Ans 658-3797