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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:42:01+00:00 2026-05-11T19:42:01+00:00

I am writing an application where memory, and to a lesser extent speed, are

  • 0

I am writing an application where memory, and to a lesser extent speed, are vital. I have found from profiling that I spend a great deal of time in Map and Set operations. While I look at ways to call these methods less, I am wondering whether anyone out there has written, or come across, implementations that significantly improve on access time or memory overhead? or at least, that can improve these things given some assumptions?

From looking at the JDK source I can’t believe that it can’t be made faster or leaner.

I am aware of Commons Collections, but I don’t believe it has any implementation whose goal is to be faster or leaner. Same for Google Collections.

Update: Should have noted that I do not need thread safety.

  • 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-11T19:42:01+00:00Added an answer on May 11, 2026 at 7:42 pm

    Normally these methods are pretty quick.
    There are a couple of things you should check: are your hash codes implemented? Are they sufficiently uniform? Otherwise you’ll get rubbish performance.

    http://trove4j.sourceforge.net/ <– this is a bit quicker and saves some memory. I saved a few ms on 50,000 updates

    Are you sure that you’re using maps/sets correctly? i.e. not trying to iterate over all the values or something similar. Also, e.g. don’t do a contains and then a remove. Just check the remove.

    Also check if you’re using Double vs double. I noticed a few ms performance improvements on ten’s of thousands of checks.

    Have you also set up the initial capacity correctly/appropriately?

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

Sidebar

Related Questions

I have been writing a small java application (my first!), that does only a
I'm writing an application that needs to read a list of strings from a
I am writing a memory tracking application that hooks all the calls to HeapAlloc
I want to have an application writing out information at the same time that
I am writing a simple memory manager for my application which will free any
Im writing an application that supposed to send coordinates in an SMS, but I've
I am writing an application in java (1.6) using swing. I currently have a
I'm writing an application that will create difficult passwords for the user. The user
I'm writing an application that interacts with other processes on a x64 Vista machine.
I'm writing an application that utilizes JavaScript timeouts and intervals to update the page.

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.