News for hackers. Stuff that matters.
Re:Mispredicted branches can multiply your running times by planteen on Wednesday October 16, 2019 @01:48PM (#21273179)
The article is C++, so not sure why you are bringing up AOT/JIT since it doesn't apply here. And clearly there is a large gain possible by doing a calculation rather than a conditional with a high entropy result, otherwise, the article's mentioned speedup wouldn't have happened. A PGO feedback loop isn't going to do anything on a high entropy conditional. I saw a great talk at CppCon 2019 by Andrei Alexandrescu about speeding up std::sort. He does this same trick among others to speed up the C++ std library sort routine.

https://www.youtube.com/watch?v=FJJTYQYB1JQ

Re:Mispredicted branches can multiply your running times by pjmlp on Wednesday October 16, 2019 @02:57PM (#21274064)
Because implementation and programming language are not the same thing?

Speaking of which, better catch up on the C++ interpreters and JIT related talks from CppCon 2019.

Re:Mispredicted branches can multiply your running times by planteen on Wednesday October 16, 2019 @03:12PM (#21274230)
I can't tell if you are trying to troll here. So you reject the notion of branchless coding as a premature optimization because you think it is going to be made irrelevant by a potential future microcode update? Or are you saying that a C++ interpreter/JIT would have made this branchless at run-time, but that optimization isn't made at compile time?
Re:Mispredicted branches can multiply your running times by pjmlp on Wednesday October 16, 2019 @05:23PM (#21275924)
The first one naturally.

The tone of my previous remark is that optimization algorithms are orthogonal to programming languages, an language agnostic backend optimizer working on AST and SSA passes doesn't care what the input language was all about.