Closed drieseng closed 5 years ago
@poke That's knowledge you gain for free by aging :-)
@Tratcher I just happened to stumble upon it. I didn't come up in profiling session or anything.
@Tratcher I would assume that this was motivated by the Value
to ValueOrDefault()
change and then the key checks were seen in the code.. 😄
Note we don't generally accept changes that are unlikely to have a demonstrable production impact. In this case there's the added benefit that it makes the code simpler.
Nullable<T>.GetValueOrDefault()
instead ofNullable<T>.Value
when it is known to have a value. See #1063 for more info.Eliminating the extra lookup yields the following result:
Before:
After:
Benchmark is available here.