Hacker News new | ask | show | jobs
by jcdavis 2756 days ago
It is in the first example (the sal instruction)
1 comments

However, if you look at the second, you won't see any left shifts, which is also interesting
I find it weird that he doesn't mention this difference as part of the performance difference. A left shift should be considerably faster than a mul operation?
I believe this is far less true than it used to be, but it’s a good example of why these decisions really need to be data driven as compilers and processors change faster than most people can afford to optimize code. I don’t know that this would be the case for something that simple but I’ve seen a fair amount of heavily-tuned C/ASM code which was replaced with the now-faster “reference” code when someone noticed that the old assumptions weren’t true.
I don't think this is generally true on modern processors.