Note that there are some explanatory texts on larger screens.

plurals
  1. POFastest Java HashSet<Integer> library
    primarykey
    data
    text
    <p>In addition to <a href="https://stackoverflow.com/questions/629804/what-is-the-most-efficient-java-collections-library">this quite old post</a>, I need something that will use primitives and give a speedup for an application that contains lots of <code>HashSet</code>s of <code>Integers</code>:</p> <pre><code>Set&lt;Integer&gt; set = new HashSet&lt;Integer&gt;(); </code></pre> <p>So people mention libraries like Guava, Javalution, Trove, but there is no perfect comparison of those in terms of benchmarks and performance results, or at least good answer coming from good experience. From what I see many recommend Trove's <code>TIntHashSet</code>, but others say it is not that good; some say Guava is supercool and manageable, but I do not need beauty and maintainability, only time execution, so Python's style Guava goes home :) Javalution? I've visited the website, seems too old for me and thus wacky.</p> <p>The library should provide the best achievable time, memory does not matter.</p> <p>Looking at "Thinking in Java", there is an idea of creating custom <code>HashMap</code> with <code>int[]</code> as keys. So I would like to see something similar with a <code>HashSet</code> or simply download and use an amazing library.</p> <p><strong>EDIT</strong> (in response to the comments below) So in my project I start from about 50 <code>HashSet&lt;Integer&gt;</code> collections, then I call a function about 1000 times that inside creates up to 10 <code>HashSet&lt;Integer&gt;</code> collections. If I change initial parameters, the numbers may grow up exponentially. I only use <code>add()</code>, <code>contains()</code> and <code>clear()</code> methods on those collections, that is why they were chosen.</p> <p>Now I'm going to find a library that implements <code>HashSet</code> or something similar, but will do that faster due to autoboxing <code>Integer</code> overhead and maybe something else which I do not know. In fact, I'm using ints as my data comes in and store them in those <code>HashSet</code>s.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload