[Mono-devel-list] [PATCH] CaseInsensitiveHashCodeProvider (CultureInfo)

Mohammad DAMT md at mt.web.id
Wed Mar 17 00:06:38 EST 2004


On Sel, 2004-03-16 at 22:12, Ben Maurer wrote:
> A hash code provider should *NEVER* allocate data when it gets the hash
> code. At the very least, it could be done in C where you can do
> malloc/free and avoid the cost of the GC (it calls into c anyways with
> your patch due to the ToLower call).

Calling to Char.ToLower (CultureInfo) is very slow. So I shortcut the
GetHashCode for invariant culture to use the old code and use internal
call for other cultures. 

Tested with cihcp.cs (attached) I get 5 seconds and 62 KB RAM allocated.
With previous patch I got 6 seconds and 29 Megs. *-)

thanks again Ben.
-- 
Mohammad DAMT <mdamt at bisnisweb.com>
http://www.bisnisweb.net ASP.Net Linux web hosting
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cihcp.cs
Type: text/x-csharp
Size: 478 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040317/5178eb68/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cihcp.diff
Type: text/x-patch
Size: 2148 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040317/5178eb68/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cihcp-mono.diff
Type: text/x-patch
Size: 3588 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20040317/5178eb68/attachment-0002.bin 


More information about the Mono-devel-list mailing list