2007/12/2, Avery Pennarun <[EMAIL PROTECTED]>: > On 02/12/2007, Andreas Nahr <[EMAIL PROTECTED]> wrote: > > Don't forget that 4 bytes per Hashcode isn't enough. You also need a boolean > > to store if the hash is already computed (as e.g. 0 is a valid hash, too). > > And then you would need one additional check for this boolean per call. > > Technically it would be safe (and no worse than current behaviour) to > recalculate the hash every time in the rare case that it's exactly > zero. > > > And don't forget that strings within the corelib ARE mutable to some extent. > > That sounds somewhat more important. > > Wouldn't it be better, in the cases where precomputing the hash would > have a large benefit, just to create a new class like > PrecomputedHashString that stores a string along with its hash? Then > the application itself could optimize for the cases where this matters > by using the different class as the key to its hash tables.
If only they didn't make string sealed ;) > > Have fun, > > Avery > _______________________________________________ > Mono-devel-list mailing list > Mono-devel-list@lists.ximian.com > http://lists.ximian.com/mailman/listinfo/mono-devel-list > -- Kamil Skalski http://nazgul.omega.pl _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list