Consider a class with several properties. To compare instances you need to compare some of their properties. If all properties except one are equal, then the number of comparisons you need to perform depends on the order of the property comparisons: if you first compare different properties, you get the result with one comparison. But if you were comparing different properties in the past, you had to make n comparisons to get the same result.
As @Kdeveloper noted, the performance difference may not be noticeable if you do not do many such comparisons in batches. But another advantage is the logical ordering of IMHO: it makes you think about the logical relationship between the properties of the class. In general, since it is an optimization without interruption (i.e., it does not make the code more difficult to read and maintain), I think it is worth doing most of the time.
source share