ekonbenefits / impromptu-interface

Static interface to dynamic implementation (duck casting). Uses the DLR combined with Reflect.Emit.
Apache License 2.0
655 stars 67 forks source link

lock and Dictionary #33

Open rioka opened 5 years ago

rioka commented 5 years ago

Not an issue, I was just looking at the code and wondering... is there any specific reason to prefer lock+standard Dictionary over ConcurrentDictionary for _typeHash and _delegateCache in BuildProxy?

jbtule commented 5 years ago

It's been so long, I'm not sure. Might have been performance tuned, or maybe not. There are tradeoffs and benefits performance wise for to ConcurrentDictionary. But honestly, it could be that it could benefit from a ConcurrentDictionary without manual locks, the choice for the dictionary was 9 years ago in the initial commit, makes me think it was something that was just overlooked.

jbtule commented 5 years ago

That line was written a month after .net 4.0 was released, I pretty sure it was just overlooked.

rioka commented 5 years ago

👍