This is the mail archive of the gcc-help@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: Removing bound checks from a switch statement


Quoting "Christoph Groth" <cwg@falma.de>:

I do not know how to solve the problem you described, but another way of
speeding up a switch statement might be using the GCC extension "Labels
as Values".

http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html

Thank you very much! This was exactly what I was looking for.


I made a completely non-standard, spaghettisized version of the program and luckily it did not run any faster than the switch-based one, so I can stick to my -ansi option. The earlier reported speedup was probably just an outlier in the performance test.

Many thanks! Now I can put this behind me and work on other aspects.
Henrik


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