home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!spool.mu.edu!sdd.hp.com!saimiri.primate.wisc.edu!sal.wisc.edu!alan
- From: alan@sal.wisc.edu (Alan Watson)
- Subject: Re: a question about if and case
- Message-ID: <1992Dec24.181129.17623@sal.wisc.edu>
- Organization: Space Astronomy Lab, Madison WI
- References: <1gi6poINN3lv@nz12.rz.uni-karlsruhe.de> <1992Dec24.092119.21197@jonlab.UUCP>
- Date: Thu, 24 Dec 1992 18:11:29 GMT
- Lines: 17
-
- In article <1992Dec24.092119.21197@jonlab.UUCP> jon@jonlab.UUCP (Jon LaBadie) writes:
- >In article <1gi6poINN3lv@nz12.rz.uni-karlsruhe.de> "hans friedrich steffani" <GM08@DKAUNI2.BITNET> writes:
- >>[Query about efficient "if-elseif-" vs switch code]
- >
- >[Discussion of the "optimal" construction based on 1986
- > compiler technology on an unspecified architecture.]
-
- You should write clear, straightforward code and rely on your compiler
- to optimize it for you. If your compiler cannot transform between
- switches and series of if-elses, then buy a better compiler.
-
- >Change only when performance has become an issue and you note,
- >through profiling, that the multi-way branch is a problem.
-
- Good advice. Unless you are writing a byte-code interpretter, the
- additional overhead of a less than optimal construction is probably
- negligible.
-