For performance, there's one exception: binary serialization of a
Dictionary<T, U>. This is tremendously slow compared to a Hashtable. For
serialization purposes use something like this:

[FastDictionary]

Have you got any data on the speedup? When I look at Dictionary in
Reflector, it doesn't seem to be that much different from your code:
they just
(1) serialize the KeyValuePairs instead of serializing keys and values
as separate object arrays, and
(2) they initialize the buckets before inserting the deserialized
KeyValuePairs (probably to preserve the ordering of the dictionary,
although I haven't checked this).

So, I'm wondering how much more efficient your FastDictionary would
be, especially since you say Dictionary serialization is tremendously
slow. Is serializing a generic type array in (1) so much slower than
serializing two object arrays?

(Also, it seems your code does not preserve the order of items in the
dictionary and it doesn't serialize the comparer, if any. Won't matter
most of the time, but worth knowing.)

Fabian

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to