Getting Started with Adobe After Effects - Part 6: Motion Blur
A collection of quick technology learning tips from what people around you learn every day

C# - Dictionary of value types provides better performance than corrosponding Hash tables of value types.

Jan 5 2012 2:51AM by Robert Dennyson   

The Dictionary(Of TKey, TValue) and ConcurrentDictionary(Of TKey, TValue) provides same functionality like Hashtable. But a Dictionary(Of TKey, TValue) of a specific type (other than Object) provides better performance than a Hashtable for value types. This is because the elements of Hashtable are of type Object; therefore, boxing and unboxing typically occur when you store or retrieve a value type.

The ConcurrentDictionary(Of TKey, TValue)class should be used when multiple threads might be accessing the collection simultaneously.Though Hashtable Synchronized method is thread safe for multiple readers and writers, but in performance point of view ,boxing and unboxing decreases the score of Hashtable.The Same theory applies in Generic List and ArrayList. Generics always Generic...!

Read More..   [67 clicks]

Published under: Microsoft .NET Tips ·  ·  ·  · 


Robert Dennyson
11 · 14% · 4430
7
 
1
 
 
0
Incorrect
 
0
Interesting
 
0
Forgotten



Submit

1  Comments  

  • Thank you I think that needed to be said. Now that I look at what you said it seems obvious but it was good to point out.

    commented on Jan 5 2012 7:12AM
    mbova407
    323 · 0% · 132

Your Comment


Sign Up or Login to post a comment.

"C# - Dictionary of value types provides better performance than corrosponding Hash tables of value types." rated 5 out of 5 by 7 readers
C# - Dictionary of value types provides better performance than corrosponding Hash tables of value types. , 5.0 out of 5 based on 7 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]