[Mono-dev] Dictionary`2: optimized and serialization-compatible with MS.net
Rodrigo Kumpera
kumpera at gmail.com
Mon Jun 11 13:50:18 EDT 2007
I don't know much about C# generics, but isn't it possible to use partial
specialization like in c++ templates? If the type uses the built-in
object.Equals/HashCode, then the performance penalty of not caching the
HashCode would be really small.
Another issue, no transformation is applied to the HashCode() result. This
is really troublesome in case of small integer keys which will fill the
first slots and cause a a big amount of collisions. The
System.Text.RegularExpressions is a good example, as most unicode characters
are smaller than 32.000, all falling into the first bucket until the table
groups larger than 67. It that's not the case, sorry for my naive analysis.
Cheers,
Rodrigo
On 6/11/07, Juraj Skripsky <js at hotfeet.ch> wrote:
>
> On Mon, 2007-06-11 at 18:27 +0200, Juraj Skripsky wrote:
> > For key types with slow Equals() methods (e.g. String.Equals, whose
> > running time is proportional to the length of the matching substring),
> > the slow down will always be substantial.
>
> Forget the part about the proportional running time - it's true only for
> strings with the same length (and without ref equality).
>
> This is not my day...
>
> Juraj
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20070611/5718b24e/attachment.html
More information about the Mono-devel-list
mailing list