Re: optimizing case-statement execution

nr@volkl.Princeton.EDU (Norman Ramsey)
Wed, 25 Nov 1992 23:44:02 GMT

          From comp.compilers

Related articles
optimizing case-statement execution raymond@harp.ecn.purdue.edu (1992-11-22)
Re: optimizing case-statement execution chased@rbbb.Eng.Sun.COM (1992-11-23)
Re: optimizing case-statement execution erspert@athena.mit.edu (1992-11-25)
Re: optimizing case-statement execution nr@volkl.Princeton.EDU (1992-11-25)
Re: optimizing case-statement execution wtyler@adobe.com (1992-11-27)
Re: optimizing case-statement execution pardo@cs.washington.edu (1992-12-04)
Re: optimizing case-statement execution krste@ICSI.Berkeley.EDU (1992-12-05)
| List of all articles for this month |

Newsgroups: comp.compilers
From: nr@volkl.Princeton.EDU (Norman Ramsey)
Organization: Princeton University, Dept. of Computer Science
Date: Wed, 25 Nov 1992 23:44:02 GMT
References: 92-11-126
Keywords: C, code, optimize

Our local `lcc' compiler uses a combination of jump tables and
test-and-branch to implement switch statements. It uses jump tables for
dense portions of the switch statement, binary search elsewhere. The
example you show has three cases: 0, 10, and 31. It may be that gcc will
use a jump table if the cases are closer together. You might be able to
fool it by adding more cases, i.e., case 1: case 2: goto default_lab; and
so on.
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.