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 8174027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T22:20:47+00:00 2026-06-06T22:20:47+00:00

I have an input which is about 450 today, and it might increase in

  • 0

I have an input which is about 450 today, and it might increase in the future. (Sometimes it is run with less than 450, maybe 100 or 20)

Is it better for me to:

  • not set capacity
  • set capacity low (100)
  • set capacity sligthly less than 450
  • set capacity sligthly above 450
  • set capacity moderatly above 450
  • set capacity to something way above expected (80% more?, twice?)

using n as number of increases (not actual complexity)
I’m, thiniking that setting it to less than expected n=440 or something will give me “complexity” n + 2n = (3n)

whereas if i put it slightly above (n=460) will give just n

also if i set n = 800 gives me a high n (almost 2n) ( high but then i use TrimToSize to make it better?

What is the best choice?

  • 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-06-06T22:20:48+00:00Added an answer on June 6, 2026 at 10:20 pm

    I’ll be honest, I glossed over all the talk of n as I believe it detracts from the real point, which is relative efficiency.

    The “best choice” is to use System.Collections.Generic.List<T>, initialize it to something sensible and then don’t worry about it until profiling tells you it’s a problem.

    The use of the generic list gives you strong typing support, and with value types, avoids boxing issues.

    If the list size is constantly changing, or the list doesn’t live for very long, trimming it won’t offer much improvement (if any). If you know certain things about the sizes involved, you can save a few re-allocations by using the overloaded constructor that takes an initial capacity:

    var list = new List<int>(450);
    

    After the initial capacity is hit, the list will continue to resize using it’s own internal logic to decide how much more to grab (the default if you don’t specify a size is to double the size: starts at 4, then 8, 16, 32, etc).

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

Sidebar

Related Questions

I have an input which gets a statement from the user. According with the
I have an input which is of this form: (((lady-in-water . 1.25) (snake .
I have an input box which is limited to 16 Numbers. What I'd like
I have this input form which goes like this: <input type=checkbox name=vehicle value=Bike />
I have a streaming input which has repeated values. I can use any data
I have an input box which I want to handle two types of information,
I have an input field which has a placeholder text. I want one word
I have an input string which is a directory address: Example: ProgramFiles/Micro/Telephone And I
i have an input field which will be displayed. i want that to hide
Good day members, I have an input file which has rows of numerical digits

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.