Search for fastest in time library(ies) for operations described (currently using hppc)

51 views
Skip to first unread message

Sophie Sperner

unread,
May 3, 2013, 9:00:25 AM5/3/13
to java-high-performance...@googlegroups.com

In my Java app, where performance (speed or execution time) is highly important, I use HPPC classes and java.util.BitSet:

import com.carrotsearch.hppc.IntSet;
import com.carrotsearch.hppc.IntOpenHashSet;

import com.carrotsearch.hppc.IntIntMap;
import com.carrotsearch.hppc.IntIntOpenHashMap;

import com.carrotsearch.hppc.IntObjectMap;
import com.carrotsearch.hppc.IntObjectOpenHashMap;

import java.util.BitSet;

IntSet set = new IntOpenHashSet();
IntIntMap iMap = new IntIntOpenHashMap();

IntObjectMap<int[]> aMap = new IntObjectOpenHashMap<int[]>();
IntObjectMap<BitSet> bMap = new IntObjectOpenHashMap<BitSet>();

and I do such operations:

// n = 62500000000; (multiplier showing relations between operations below)
// constants 12345, 67890, new int[100000] used for presentation purpose only

// this line is executed 15 625 000 000 (= n / 4) times
set.add(12345);

// this line is executed 62 500 000 000 (= n) times
iMap.put(12345, 67890);

// these two lines are executed 62 500 000 000 (= n) times
aMap.put(12345, new int[100000]);
bMap.put(12345, new int[100000]);

// these two lines are executed 125 000 000 000 (= n * 2) times
int[] ints = aMap.get(12345);
BitSet bits = bMap.get(12345);

// these two lines are executed 187 500 000 000 (= n * 3) times
int card = ints.length;
int card = bits.cardinality();

// these two lines are executed 124 999 500 000 (= n * 2 - 500000) times
clonedBits = (BitSet) bits.clone();
clonedBits.and(otherBits);

// this loop (each time iterating bits.cardinality() times) is executed
// 31 250 000 000 (= n / 2) times and the total number of iterations
// equals bits1.cardinality() + ... + bits31250000000.cardinality()
for (int i = bits.nextSetBit(0); i >= 0; i = bits.nextSetBit(i+1)) {
    doSomeCode();
}

To conlude, these operations have been used: cardinality(), clone(), and(), nextBitSet() of BitSet class, get(), put() of each Map class and add() of IntSet class. No other operations have been executed.

Question: what is library to choose in terms of performance (speed) in order to handle above operations efficiently? The list of candidates has been found:

Will benchmark myself, but if somebody knows definitely what is faster and when, please let us know.

Best wishes,

Sophie

Dawid Weiss

unread,
May 3, 2013, 9:15:01 AM5/3/13
to java-high-performance...@googlegroups.com
Replied on fastutil's mailing list -- question was cross posted.

Dawid
> --
> 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 Sperner

unread,
May 3, 2013, 9:26:03 AM5/3/13
to java-high-performance...@googlegroups.com
Agree, this post must be deleted then.
> java-high-performance-primitive-collections+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages