When we try to do a comparison for a Boolean type the developers are used to use below methods.
//case for negation
if !result {//goes in condition if result is false}
Easily readable option
if result == false {//goes in condition if result is false}
But have we ever notice that this simple change can do wonders for compilation in swift?
If a negation comparison takes 10 ms the == operator can take around 40 times more time to compile.
Reason
There are lot of overloads for the ==
operator than for the boolean comparison. The (==) equality operator has lot of equality condition under the hood with a pretty syntax.
On the other hand comparison for negation is pretty simple.
Reference