6 ms·
Another tip is to not be too smart in optimising your conditions either — I've once reviewed a branch with a complex if condition that made no sense, before rea
by necovek 7y ago
Another tip is to not be too smart in optimising your conditions either — I've once reviewed a branch with a complex if condition that made no sense, before realising that it was the result of applying De Morgan's rules.
So, express the intent, but do not mathematically simplify or evaluate it (let the compiler/interpreter do that, or if it is really a performance hotspot, describe the intent even though comments are supposed to be about whys and not whats).