|REQ: switch optimization info email@example.com (1995-06-25)|
|Re: REQ: switch optimization info firstname.lastname@example.org (1995-07-01)|
|Re: REQ: switch optimization info email@example.com (1995-07-03)|
|From:||firstname.lastname@example.org (Chris Arthur)|
|Organization:||Alternate Access Inc.|
|Date:||Sun, 25 Jun 1995 03:31:46 GMT|
I'm looking for any (unpatented!) research that anyone has done on (or
other information relating to) optimization of and code generation for
C/C++ switch statements (or similar constructs in other languages).
The switch code generation techniques I'm aware of include biasing,
generation of split tables, and binary searching (as well as
combinations of the above), but I was wondering if someone had looked
for (and found) slicker ways to generate fast and/or small switch
code. And I was looking for information on how those who have gone
before me have selected code generation strategies (ie, what switch
density is the cutoff between, say, generating a single table and
filling in the gaps, versus generating a binary search). And it seems
to me that (depending on the architecture, of course) it might well be
that if small code is the top priority and speed is a lesser concern,
it would be best to generate a table containing both case label values
and jump addresses along with an actual binary search loop, rather
than generating an if-then-else tree to implement the binary
search...yet every compiler I've tried thus far generates the
if-then-else style binary search (if it does a binary search at all).
I doubt I'm the first person to think of doing it that way, but if
it's a bad idea, I don't see why...
I would also be interested in pointers to online resources (including
but not limited to WWW sites) for locating answers to questions like
this. The ACM Web site is *painfully* slow, and Yahoo didn't have
much, either...And I couldn't find a FAQ for comp.compilers.
Many thanks for any help!
Compiler & related jobs at Seattle-area semi-startup -- email email@example.com.
Only *you* can prevent softare patents -- email firstname.lastname@example.org for info.
Christopher S. Arthur -- email@example.com -- 206-637-5184(w) -- 206-823-4490(h)
[A heap search using test abd branches is also popular for large sparse
Return to the
Search the comp.compilers archives again.