Repository navigation
Removing redundant comparison with "null" - #53
Conversation
…rset condition for (obj == null))
|
Looks reasonable to me. |
|
Isn't "obj == null" a lot less expensive than "is"? |
|
@mikaeldui, yes, but in the case of a non-null obj with wrong type, the whole condition will more expensive. |
|
👍 LGTM |
|
I ran some microbenchmarks, which were either inconclusive or slightly favored the change. Given that, and that this change makes the code cleaner, LGTM2. |
|
Feels like quite a minor improvement - but Andreys solution is more favorable than the existing since it does not try to outsmart the compiler. There is also a third style that could be used that looks like the following: Hard to tell which one is nicest, but guess it does not matter that much since this issue probably won't have any real impact on the readability or performance. |
Mono specific conditionals in preparation of getting `System.Buffers.Text`.
Removing redundant comparison with "null" ((!(obj is Vector)) is superset condition for (obj == null))