Related articles |
---|
Multibyte/Wide Character Sets and Lex. juliano@SYDPO4.AUS.unisys.com (Orbach, Julian ACUS) (1996-02-09) |
Re: Multibyte/Wide Character Sets and Lex. colas@aye.inria.fr (1996-02-09) |
Re: Multibyte/Wide Character Sets and Lex. sharris@fox.nstn.ca (Sandy Harris) (1996-02-10) |
Re: Multibyte/Wide Character Sets and Lex. schwartz@galapagos.cse.psu.edu (1996-02-12) |
Re: Multibyte/Wide Character Sets and Lex. pjbumbul@math.uwaterloo.ca (1996-02-13) |
Re: Multibyte/Wide Character Sets and Lex. fjh@cs.mu.OZ.AU (1996-02-13) |
Re: Multibyte/Wide Character Sets and Lex. peter@csgrs6k1.uwaterloo.ca (1996-02-14) |
Re: Multibyte/Wide Character Sets and Lex. mparks@oz.net (Michael Parkes) (1996-02-14) |
Re: Multibyte/Wide Character Sets and Lex. jfc@mit.edu (1996-02-14) |
From: | peter@csgrs6k1.uwaterloo.ca (Peter Bumbulis) |
Newsgroups: | comp.compilers |
Date: | 14 Feb 1996 21:21:02 -0500 |
Organization: | University of Waterloo |
References: | 96-02-065 96-02-115 96-02-135 |
Keywords: | lex, optimize |
pjbumbul@math.uwaterloo.ca (Peter Bumbulis) writes:
>re2c can translate switch statements into nested ifs (usually a
>performance win.)
<fjh@cs.mu.OZ.AU> wrote:
>Why is this usually a performance win?
re2c does a better job than a number of popular compilers (for the
switches it generates.)
>[C compilers I know have three strategies for translating switches: a
>branch table if the cases are dense, a linear lookup if there's a
>small number of sparse cases, and an open-coded binary tree,
>i.e. nested if's, otherwise. -John]
re2c's heuristics are tuned for translating the switches it generates.
Besides the above strategies re2c will also generate bit vectors to
facilitate quick tests for class membership. re2c also takes into
account the fact that it can reuse code from other switches when
deciding upon a strategy for a particular switch. The code that re2c
generates can be improved: the default entries in most of the switches
generated are actually never used, this information is not currently
taken advantage of (and cannot be communicated in a switch.) Note
that the heuristics that re2c uses are probably not what you want to
use in general.
Peter
--
Peter Bumbulis peter@csg.uwaterloo.ca
Computer Systems Group / University of Waterloo / Waterloo, Ontario / N2L 3G1
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.