This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: switch statement performance


Paul Vixie <paul@vix.com> writes:

> > You see, the generated code shouldn't be equivalent to an if-else
> > chain.  It's supposed to be a binary tree, which would be only at most
> > 6 or 7 branches deep (well, I think we actually do a binary tree for
> > the outside conditions, and then an if-else chain for the inner ones,
> > since not-taken branches are cheaper), and therefore shouldn't have
> > particularly bad performance.
> 
> how long as it been doing this?

For more than ten years.

> so if i have to compile stuff like this on non-gcc platforms (like native
> solaris and tru64 which a lot of bind users seem to have) i'll be at the
> mercy of their compilers?

Well, yes.  Though probably their compilers are just fine.

I think it's asking a bit much for gcc to tell you when code might be
poorly compiled by some other compiler.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]