Getting Started with Web applications development with servlets and JSP - Part 5: Filters
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.


Upload Image Close it
Select File

Share a .NET tip or learn from what others have shraed.

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..  [37 clicks]


Robert Dennyson
17 · 11% · 2563
7
 
1
 
 
0
Incorrect
 
0
Interesting
 
0
Forgotten
 
0
Move



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  .  Report Abuse This post is not formatted correctly
    mbova407
    346 · 0% · 78

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 © Beyondrelational.com Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising