home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / compiler / 2022 < prev    next >
Encoding:
Text File  |  1992-12-13  |  2.0 KB  |  47 lines

  1. Newsgroups: comp.compilers
  2. Path: sparky!uunet!think.com!spdcc!iecc!compilers-sender
  3. From: henry@zoo.toronto.edu (Henry Spencer)
  4. Subject: Re: static estimation of conditional branches?
  5. Reply-To: henry@zoo.toronto.edu (Henry Spencer)
  6. Organization: U of Toronto Zoology
  7. Date: Sun, 13 Dec 1992 05:09:24 GMT
  8. Approved: compilers@iecc.cambridge.ma.us
  9. Message-ID: <92-12-054@comp.compilers>
  10. Keywords: optimize
  11. References: <92-12-029@comp.compilers> <92-12-049@comp.compilers>
  12. Sender: compilers-sender@iecc.cambridge.ma.us
  13. Lines: 32
  14.  
  15. > The other problem that occurs with such facilities is that programmer
  16. > intuition is notoriously unreliable about such things.
  17.  
  18. idacrd!desj@uunet.UU.NET (David desJardins) writes:
  19. >... any programmer who is making a serious effort to write high-
  20. >performance code must know approximately how often each of the conditional
  21. >branches in critical sections is taken...
  22.  
  23. I agree with this statement, with one crucial substitution: for "must"
  24. read "should", in the sense of "you should stay below the speed limit".
  25.  
  26. When people first started implementing profilers and the like, they found
  27. one striking result: human intuition about the locations of the hot spots
  28. in a complex program was *consistently wrong*.  All kinds of attention had
  29. gone into optimizing things that weren't important, or even made things
  30. worse in unforeseen ways.
  31.  
  32. >... It's a question of understanding what the code is doing: an
  33. >understanding which is fundamental to optimization.
  34.  
  35. Indeed so.  And you get that sort of understanding only by measurement.
  36. Guesswork, even informed guesswork, is known to be inadequate... but
  37. people rely on it nevertheless.
  38.  
  39. If you've got the measurements, just supplying *them* direct to the
  40. compiler works much better.  If nothing else, it avoids the temptation to
  41. skip that annoying measurement step and just wing it.
  42. -- 
  43. Henry Spencer @ U of Toronto Zoology, henry@zoo.toronto.edu  utzoo!henry
  44. -- 
  45. Send compilers articles to compilers@iecc.cambridge.ma.us or
  46. {ima | spdcc | world}!iecc!compilers.  Meta-mail to compilers-request.
  47.