▲ | brokencode 10 days ago | ||||||||||||||||||||||
That feels like.. something the compiler should be optimizing for you? I would certainly be among those questioning this code. | |||||||||||||||||||||||
▲ | marginalia_nu 10 days ago | parent [-] | ||||||||||||||||||||||
The compiler can't know from the code alone which branch is more likely. This is a property of the input data and not the code. Really advanced JIT compilers can sometimes do those types of optimizations, but this is a fairly rare scenario. | |||||||||||||||||||||||
|