|
-
March 26th, 2012, 11:18 AM
#8
Re: Switch case or something better!
 Originally Posted by VladimirF
Great analysis.
Thanks! 
I think the conclusion should be: don’t presume that you can outrun modern compiler. At least, not before serious profiling.
Right. It may sometimes pay to try to give the compiler something that's easier to optimize, but it's almost never worth the effort trying to to coerce it into doing something it wouldn't have done naturally anyway.
IMO this "clustered cases" optimization is rather specific, yet practice shows that this is a quite common scenario in everyday programming, so it's worth the effort to program that into the compiler.
Offtop: Sorry Eri, but I am not allowed to rate your posts
I was able to rate yours, so this does not seem to be due to the current problems with the forum software. (This specifc post of yours may not actually have deserved a rating, but I think overall you deserve one from me from time to time... ) The last rating I got from you (thanks again ) was from Feb 29th, almost four weeks ago, but AFAICT the point in time when you can come back and rate a user's post again also depends on how many ratigngs you gave to other users in the meantime. So it's not so easy to calculate...
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|