[Mono-list] Mono/C# microbenchmarks
Paolo Molaro
lupus@ximian.com
Tue, 20 Aug 2002 11:02:37 +0200
On 08/19/02 David Jeske wrote:
> I'm somewhat surprised at how much faster the hashtable based
> index_test and index_string_test come out in the C version. There must
> be some nasty stuff going on in C# to get a unique hash value, particularly
> for integers.
>
> Oddly, Python seems to be in the same ballpark as C# on the index_test
> and index_string_test. That leads me to believe it's some kind of
> type-munging overhead taking the time, which absent from the C/glib
> version.
It's called boxing: when you store an integer in a hash table, the value
is boxed inside an object (so the object needs to be allocated etc.).
This happens for all the valuetypes (ints, floats, structs): you need a
specialized hashtable for your type (or you'd need to wait for generics
to be standardized and implemented...).
Thanks for the data.
lupus
--
-----------------------------------------------------------------
lupus@debian.org debian/rules
lupus@ximian.com Monkeys do it better