I've read here at SO that Hashtable and Dictionary are pretty much the same except for the advantages of avoiding boxing/unboxing.
Using the Ants Profiler I measure a very simple app with the following structures:
class Node
{
Dictionary<string, Node> Children = new Dictionary<string, Node>();
}
and
class NodeOld { Hashtable Children = new Hashtable(); }
Ok, a list of 1.5Million instances of the first takes about 140Mb, while the second needs more than 700Mb (64bits system).
So, there's a HUGE difference in implementation, isn't it?
The Ants Profiler unveils a HUGE number of Hashtable+Bucket objects on the big-sized example...
So, is there an equivalent (memory-savvy) option for Dictionaries if you've to stick to 1.1?
Even if I am stuck on .NET 1.1 I wouldn't be storing 1.5 million instances into memory, so I wouldn't care about. Hashtable is probably the best data structure implementing a hash-table you could get in terms of memory consumption and speed in .NET 1.1. Of course if you explained your scenario in a more details and that you have identified that Hashtable is actually a bottleneck for your application there might be some better solutions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With