Search in sources :

Example 6 with IntIntHashMap

use of org.eclipse.collections.impl.map.mutable.primitive.IntIntHashMap in project eclipse-collections by eclipse.

the class IntIntMapSmallStressTest method setUp.

@Setup
public void setUp() {
    this.intIntKoloboke = HashIntIntMaps.newMutableMap(MAP_SIZE);
    this.intIntEc = new IntIntHashMap(MAP_SIZE);
    this.integerIntegerJdk = new HashMap<>(MAP_SIZE);
    Random random = new Random(0x123456789ABCDL);
    int[] randomNumbersForMap = this.getRandomKeys(random).toArray();
    int number = 23;
    int lower = Integer.MIN_VALUE;
    int upper = Integer.MAX_VALUE;
    this.kolobokeIntKeysForMap = this.fullyRandom ? randomNumbersForMap : this.getKolobokeArray(number, lower, upper, random);
    this.ecIntKeysForMap = this.fullyRandom ? randomNumbersForMap : this.getECArray(number, lower, upper, random);
    this.jdkIntKeysForMap = this.fullyRandom ? IntIntMapSmallStressTest.boxIntArray(randomNumbersForMap) : this.getJDKArray(lower, upper, random);
    for (int i = 0; i < KEY_COUNT; i++) {
        this.intIntKoloboke.put(this.kolobokeIntKeysForMap[i], 5);
        this.intIntEc.put(this.ecIntKeysForMap[i], 5);
        this.integerIntegerJdk.put(this.jdkIntKeysForMap[i], 5);
    }
    this.shuffle(this.ecIntKeysForMap, random);
    this.shuffle(this.kolobokeIntKeysForMap, random);
    this.shuffle(this.jdkIntKeysForMap, random);
}
Also used : IntIntHashMap(org.eclipse.collections.impl.map.mutable.primitive.IntIntHashMap) Random(java.util.Random) Setup(org.openjdk.jmh.annotations.Setup)

Example 7 with IntIntHashMap

use of org.eclipse.collections.impl.map.mutable.primitive.IntIntHashMap in project eclipse-collections by eclipse.

the class IntIntMapTest method setUp.

@Setup
public void setUp() {
    int[] highMasks = new int[64];
    for (int i = 0; i < 64; i++) {
        highMasks[i] = i << 26;
    }
    int[] randomSeeds = new Random(0x123456789ABCDL).ints().limit((long) this.mapSizeDividedBy64).toArray();
    this.randomIntsForKeys = new int[this.mapSizeDividedBy64 * 64];
    Random randomSeeds2 = new Random(0x123456789ABCDL);
    for (int i = 0; i < randomSeeds.length; i++) {
        for (int j = 0; j < 64; j++) {
            if (this.fullyRandom) {
                this.randomIntsForKeys[i * 64 + j] = randomSeeds2.nextInt();
            } else {
                this.randomIntsForKeys[i * 64 + j] = randomSeeds[i] ^ highMasks[j];
            }
        }
    }
    this.randomIntsForValues = new Random(0x123456789ABCDL).ints().limit((long) (this.mapSizeDividedBy64 * 64)).toArray();
    this.intIntMap = new IntIntHashMap();
    for (int i = 0; i < this.mapSizeDividedBy64 * 64; i++) {
        this.intIntMap.put(this.randomIntsForKeys[i], this.randomIntsForValues[i]);
    }
    this.shuffle(this.randomIntsForKeys, randomSeeds2);
}
Also used : IntIntHashMap(org.eclipse.collections.impl.map.mutable.primitive.IntIntHashMap) Random(java.util.Random) Setup(org.openjdk.jmh.annotations.Setup)

Aggregations

IntIntHashMap (org.eclipse.collections.impl.map.mutable.primitive.IntIntHashMap)7 Random (java.util.Random)3 Setup (org.openjdk.jmh.annotations.Setup)3 CharObjectHashMap (org.eclipse.collections.impl.map.mutable.primitive.CharObjectHashMap)1 IntHashSet (org.eclipse.collections.impl.set.mutable.primitive.IntHashSet)1 Test (org.junit.jupiter.api.Test)1