Fast Dictionary and struct generic arguments

added by DotNetKicks
3/22/2017 1:12:53 PM

2 Kicks, 181 Views

The actual dictionary impl is very close to the standard one, but that isn't what make it fast. Note the generic argument? If we pass a struct implementing IEqualityComparer generic argument, then in most cases, the compiler and the JIT are going to generate code that is able to eliminate all virtual calls.