[Mono-dev] Hashtable.Clone speedup.

Miguel de Icaza miguel at ximian.com
Fri May 23 11:50:50 EDT 2008

Hello Konstantin,

> We probably don't want to copy serializationInfo too, but need to copy
> equalityComparer.
> In addition, Array.Clone() should be the fastest way to copy arrays.
> BTW, why do we need a copy ctor, if we have public Clone()?

This is great feedback.   Copy was faster for arrays larger than 40
(Slot), but Clone is always faster than both.

I merely used a new constructor to avoid creating the object and having
it hit the initialization code path, only to overwrite every
initialization done there with the data from the copy.

Thanks for the pointer about the missing NET_2_0 field, here is an
updated patch.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hashtable2.patch
Type: text/x-patch
Size: 1495 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080523/a1cb16b3/attachment.bin 

More information about the Mono-devel-list mailing list