News for hackers. Stuff that matters.
Re:Six times faster than C by okaleniuk on Friday July 07, 2023 @04:10AM (#36628710)
Yes, but this will backfire on ARM, where jumps are as roughly fast as conditional arithmetic.

The whole point of using C is not to think about the underlying architecture. As soon as you start taking "jumps are a lot slower than conditional arithmetic on x86" into account, you're not writing in C, you're writing in assembly with extra steps :-)

Re:Six times faster than C by bruce343434 on Friday July 07, 2023 @07:57AM (#36630354)
Is that because cjumps on ARM are faster, or cmovs on ARM are slower?
Re:Six times faster than C by dzaima on Friday July 07, 2023 @09:44AM (#36631648)
Note, that's only ARMv7; ARMv8 dropped most of the conditionally executed instruction stuff. And so it isn't even jumps that's fast on ARMv7, it's specifically cases that can be (and are) converted to predicated instrs; jumps are still gonna be slow in general on anything high-perf enough that it needs speculation, which can include the actual jumps of ARMv7.

If a compiler can convert jumpy code to the predicated instrs, it should be able to trivially convert conditional arith to such too (even easier & more consistently than branches I'd say).