mail at tinco.nl
Sat Dec 1 10:16:41 EST 2007
(Woops, only replied to kamil)
If Jerome is right and the overhead is only 4 bytes, then overhead shouldn't be a problem at all. The worst case size of a string would be 1 character, of 2 bytes + something to end it with, like an int containing its length, 2 bytes, or a terminating character, probably 2 bytes too. Making it at least 4 bytes. A worst case scenario of 100% extra data, that isn't so bad right? It's way less than the overhead of using unicode, since you almost never use the enormous range of character 2-3 bytes offers you. Speaking of unicode/utf-16 and memory, couldn't a lot of memory be spared if strings where stored as utf8 internally, which would be converted back to utf-16 when more than 256 different characters would be used? All you would need is a small translation table, and the view instructions it takes to look a char up in it. Or is this already being done? Just curious. Tinco
> Date: Fri, 30 Nov 2007 19:10:07 -0800> From: kamil.skalski at gmail.com> To: alan.mcgovern at gmail.com> CC: mono-devel-list at lists.ximian.com> Subject: Re: [Mono-dev] String.GetHashCode()> > Extra memory cost, which would hit all allocated strings, also those> short ones. For some applications, which use millions of small strings> this would be unacceptable hit.> > 2007/11/30, Alan McGovern <alan.mcgovern at gmail.com>:> > A thought struck me while i was dozing on the plane on the way home from the> > summit.> >> > Since strings are immutable, shouldn't it be possible to compute the> > hashcode once and store it rather than recomputing it over and over again?> > Is there some really obvious reason that i can't think of that would make> > this a bad idea?> >> > Alan.> >> > _______________________________________________> > Mono-devel-list mailing list> > Mono-devel-list at 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 at lists.ximian.com> http://lists.ximian.com/mailman/listinfo/mono-devel-list
Express yourself instantly with MSN Messenger! MSN Messenger
Express yourself instantly with MSN Messenger! Download today it's FREE!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Mono-devel-list