Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6092617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:27:47+00:00 2026-05-23T12:27:47+00:00

I want to cache 10.000+ key/value pairs (both strings) and started thinking which .NET

  • 0

I want to cache 10.000+ key/value pairs (both strings) and started thinking which .NET (2.0, bound to MS Studio 2005 🙁 ) structure would be best. All items will be added in one shot, then there will be a few 100s of queries for particular keys.

I’ve read MSDN descriptions referenced in the other question but I stil miss some details about implementation / complexity of operation on various collections.
E.g. in the above mentioned question, there is quote from MSDN saying that SortedList is based on a tree and SortedDictionary “has similar object model” but different complexity.
The other question: are HashTable and Dictionary implemented in the same way?

For HashTable, they write:

If Count is less than the capacity of the Hashtable, this method is an O(1) operation. If the capacity needs to be increased to accommodate the new element, this method becomes an O(n) operation, where n is Count.

But when the capacity is increased? With every “Add”? Then it would be quadratic complexity of adding a series of key/value pairs. The same as with SortedList.

Not mentioning OrderedDictionary, where nothing is mentioned about implementation / complexity.

Maybe someone knows some good article about implementation of .NET collections?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:27:48+00:00Added an answer on May 23, 2026 at 12:27 pm

    If you are adding that many pairs, you can/should use this Dictionary constructor to specify the capacity in advance. Then every add and lookup will be O(1).

    If you really want to see how these classes are implemented, you can look at the Rotor source or use .NET Reflector to look at System.Collections (not sure of the legality of the latter).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to cache custom data in an ASP.NET application. I am putting lots
I have set of data which contains images also. I want to cache this
It's common to want browsers to cache resources - JavaScript, CSS, images, etc. until
I want to display from cache for a long time and I want a
I want to implement a two-pass cache system: The first pass generates a PHP
Never used a cache like this before. The problem is that I want to
I want to delete cache files in a directory, the directory can contain up
Lets say I have around 1,000,000 users. I want to find out what position
I have an application that will download and cache, at a minimum, 250,000 8KB*
I want to cache the response to image requests. The images are the results

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.