On 03/23/2012 07:10 PM, H. S. Teoh wrote:
On Fri, Mar 23, 2012 at 07:01:46PM +0100, Timon Gehr wrote:
Why do you not just do the conversion and then compute the hash, even
if the representation is the same?

Because Andrei says that the .idup shouldn't be performed unless it's
necessary (e.g., you should be able to lookup char[] in a string-keyed
AA without incurring the overhead of an .idup each time). The conversion
is not needed if the hash computation doesn't change and we don't need
to create a new entry.


T


That does not apply to your example with double and int. (I'd argue that actually the other overload should be chosen in that case, because the conversion is implicit)

For implicit .idup, one solution would be to compare immutable(Key) and immutable(T). If they are the same, then the representation is the same.

Reply via email to