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

  • SEARCH
  • Home
  • 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 989405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:47:13+00:00 2026-05-16T05:47:13+00:00

I have about 3000 different files I need to organize, and retrieve at different

  • 0

I have about 3000 different files I need to organize, and retrieve at different times during the game.

I created my own struct of variables.
I was thinking about creating a “Dictionary ”
at the beginning of my application, and simply loading all my files before the game starts.

I’m wondering about performance: will a dictionary with this many entries cause my application to be slow?
Would a large dictionary make “TryGetValue” and “ContainsKey” run slower?

thanks for the advice!

  • 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-16T05:47:14+00:00Added an answer on May 16, 2026 at 5:47 am

    TryGetValue and ContainsKey should be pretty fast at that size, as long as the key has well distributed hashes.

    A Dictionary has an indexable number of “buckets”. When it adds or looks for a value by a key it will take the value returned by GetHashCode(), hash it down again to be less than the number of buckets (generally something simple like modulo, but the implementation isn’t defined), and look in the relevant bucket.

    The bucket will currently have zero or more items. The dictionary will compare each item with the key using .Equals().

    The first bit of finding the right bucket is going to be in constant time O(1). The second bit of comparing the key with the keys in the bucket is going to be in lineary time O(n) where n relates only to the number of items in that bucket, not in the whole collection.

    Generally there should be very few items in each bucket (the number of buckets will grow to try to keep this the case) so the operation is essentially constant time.

    If however your hash codes are poorly implemented, there will be lots of keys in the same bucket. The time complexity will get closer and closer to O(n), as can be seen by experimenting with an object with a deliberately bad GetHashCode that just returns 0 every time. In its worse case it is worse than a List, since a List is also O(n), but Dictionary has more overhead.

    Does any of this mean you should worry? No, even relatively naïve hashing methods should give relatively good results. If you’re using a string key, then it’s probably already going to be more than good enough. If you’re using a simple built-in type, then even more so.

    If you do find that accessing the dictionary is slow though, then you want to pay attention to this and either fix the GetHashCode() method or create an IEqualityComparer (which lets you define outside rules for GetHashCode() and Equals() for use with dictionaries, hashsets, etc).

    Most likely though, 3000 is nothing, it’ll be fine.

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

Sidebar

Related Questions

I have setup an application to parse about 3000 files a day where each
I have about 3000 images and 13 different colors (the background of the majority
In an application I will have between about 3000 and 30000 strings. After creation
I have an SQL document formatted as so (It has about 3000 entries like
I have about 200 Excel files that are in standard Excel 2003 format. I
All, I have about 3000 words with definitions that I am loading into a
I have a table with about 3000 records that I query often. Does mysql
We have project with a server witch have about 3000 requests at day from
I have some points (about 3000) and edges (about 6000) in this type of
I have a spatial dataframe with about 3000 points. I want to generate a

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.