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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:09:43+00:00 2026-05-30T03:09:43+00:00

I have a map with about 100,000 pairs . Is there any way that

  • 0

I have a map with about 100,000 pairs . Is there any way that i can speed up searching when using find(), given that the keys are in alphabetical order. Also how should i go about doing it. I know that you can specify a new comparator when you create the map. But will that speed up the find() function at all?

Thanks in advance.

[solved] Thanks a bunch guys i have decided to go with a vector and use lower and upperbound to “snip” some of the searching.

Also i am new here is there any way to mark this question as answered , or pick a best answer?

  • 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-30T03:09:44+00:00Added an answer on May 30, 2026 at 3:09 am

    A different comparator will only speed up find if it manages to do the comparison faster (which, for strings will usually be pretty difficult).

    If you’re basically inserting all the data in order, then doing the searching, it may be faster to use a std::vector with std::lower_bound or std::upper_bound.

    If you don’t really care about ordering, and just want to find the data as quickly as possible, you might find that std::unordered_map works better for you.

    Edit: Just for the record: the way you “might find” or “may find” those things is normally by profiling. Depending on the situation, it might be enough faster that it’s pretty obvious even in simple testing, so profiling isn’t really necessary, but if there’s (much) doubt, or you want to quantify the effect, a profiler is probably the right way to do it.

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

Sidebar

Related Questions

I have image map that can I move, but this map will be so
I have a google map script that works, but I can't figure out how
I have a UIView in a scrollview that contains about 100 subviews. The subviews
i have another (probably unanswered) question about map views. I have a map view
I have the following code: def maturities InfoItem.find_all_by_work_order(self.work_order).map(&:maturity) end I was thinking about changing
I have a map that i want to update from a separate thread. Im
I have a large amount of Key-Value parameters that map to a file path.
I have the following query method that has slow performance: @Override public Map<String, Long>
Possible Duplicate: Hash tables in MATLAB General Question Is there any way to get
I have a 'black box' application that gets a map of values as parameters,

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.