[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Switch/Case statements revisited
- From: Mike Pall <mikelu-0711@...>
- Date: Fri, 9 Nov 2007 19:35:25 +0100
David Given wrote:
> Yes, but you don't want to sacrifice speed unnecessarily. The advantage of
> the above syntax is that it's entirely obvious to the compiler when you're
> matching against a specific item (with <expr> [, <expr>...] then) or
> against an expression (with <varname> if). This makes it trivial for, say,
> the JIT to construct real jump tables.
Jump tables are for AOT compilers. JIT compilers have better ways
to optimize this, like profile-directed tree-dispatch. And it
shouldn't matter which control-flow constructs in the source
language generated the dispatch.
[However I'm amazed to see a glimpse of a thought about semantics
in the boring bi-monthly discussion on shallow syntax matters.]