I'm using many sets IntSet set = new IntOpenHashSet(); in my code and then do set.add(), set.clear(), set.contains() operations only, I do not lookup (set.get()). I changed all the Java HashSets and found no speedup at all, even an overhead in my program. I do measure the execution time and was expecting to find hppc to be faster. Maybe I misunderstood something.
Is IntOpenHashSet is fine for storing ints?
Thank you.
> So HashSet<Integer> is the same in performance as IntOpenHashSet. Alright.
Oops, sorry -- I thought you were talking about bitsets. If you're
talking about maps or sets of integers then the difference should be
visible and significant assuming that your set of keys (Integers) is
quite large; don't know how many objects you put in there.
> I have a HashMap<Integer, ArrayList<Item>> where Item is my program-specific
How many unique keys in those maps? If there are not too many the
difference will be obscured by other parts of the code.
> recommend to use HPPC in order to work with int[] keys and Integer to avoid
> autoboxing etc.
Assuming you have plenty of keys to work with
IntObjectOpenHashMap<List<Item>> will be suitable. It will save space
on keys (no boxed integers) and should give you favorable collision
rates compared to standard maps. I would first try to detect
bottlenecks though -- maybe your program spends 99% of time elsewhere,
not in key lookup. Then you're aiming at the wrong target.
--
You received this message because you are subscribed to the Google Groups "High Performance Primitive Collections for Java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to java-high-performance-primi...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Sophie
--
Again -- are you completely sure it is hanging inside the get() method and not looping in your code somewhere?
Can you get a stack trace (or a few stack traces) to confirm where it's at? If you can dump the contents of the map to the console and send me that along with the key that causes the dump I'll take a look!
Well, that's not good. Please do the following:
1) make sure your JVM runs with assertions enabled (pass -ea switch to your Java; I don't know what environment you launch from but this should be straightforward).
2) If you could dump the state of that map before it enters the loop and then all of the indices you access it'd be great. You can dump the state of the map using apache commons-lang library, using this class:
Please pack it into a txt file and send it to me with the snippet of code that loops over this array (preferably with the one you used to dump the above information, it'll help in reproducing the problem).
Thanks,
Dawid
--