I don't see an issue with the gotos, those are direct jumps so there is no cost 
there.

The real question is the if branching vs cmov.

I do not now the impact of Meltdown, Spectre and L1TF mitigation on Haswell 
branch predictors though as one of the main goal was fixing speculative 
execution and much of Haswell performance came from its very impressive 
predictors.

Here is a benchmark suite for branch vs branchless: 
[https://github.com/xiadz/cmov](https://github.com/xiadz/cmov).

On past architecture (circa 2010) if/else was faster than cmov for predictable 
branches (like testing if nil), seems like it changed for Skylake (security 
patch might change that again).

Also ARM, MIPS arch, and even AMD processors might have a completely different 
behaviour.

Finally cmov only make sense for assignment like this:

let foo = if bool_a: 10 else: 20

Reply via email to