From 9f463ae2fae88b69628b29c1c0abdc36aa9cde77 Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 14:29:23 +0300 Subject: [PATCH 01/17] =?UTF-8?q?"zero=20fat"=20edition=20LongLongMap?= =?UTF-8?q?=E2=86=92ConcurrentLongLongMap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trivago/kangaroo/AbstractBenchHelper.java | 8 ++-- .../LongLongMap.java | 42 ----------------- .../map/ConcurrentBusyWaitingLongLongMap.java | 28 ++--------- .../map/ConcurrentLongLongMap.java | 32 +++++++------ .../ConcurrentLongLongMapBuilderTest.java | 8 ++-- .../longlong/AbstractLongLongMapTest.java | 46 +++++++++---------- .../ConcurrentBusyWaitingLongLongMapTest.java | 5 +- .../longlong/ConcurrentLongLongMapTest.java | 5 +- .../PrimitiveFastutilLongLongWrapperTest.java | 4 +- 9 files changed, 57 insertions(+), 121 deletions(-) delete mode 100644 src/main/java/com/trivago/fastutilconcurrentwrapper/LongLongMap.java diff --git a/src/jmh/java/com/trivago/kangaroo/AbstractBenchHelper.java b/src/jmh/java/com/trivago/kangaroo/AbstractBenchHelper.java index 0d807f7..5d6ceb6 100644 --- a/src/jmh/java/com/trivago/kangaroo/AbstractBenchHelper.java +++ b/src/jmh/java/com/trivago/kangaroo/AbstractBenchHelper.java @@ -1,24 +1,24 @@ package com.trivago.kangaroo; -import com.trivago.fastutilconcurrentwrapper.LongLongMap; import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; +import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongLongMap; import java.util.concurrent.ThreadLocalRandom; public abstract class AbstractBenchHelper extends AbstractCommonBenchHelper { protected static final int NUM_VALUES = 1_000_000; - protected LongLongMap map; + protected ConcurrentLongLongMap map; public void initAndLoadData(PrimitiveMapBuilder.MapMode mode) { if (mode == PrimitiveMapBuilder.MapMode.BUSY_WAITING){ - map = LongLongMap.newBuilder() + map = ConcurrentLongLongMap.newBuilder() .withBuckets(16) .withInitialCapacity(NUM_VALUES) .withMode(PrimitiveMapBuilder.MapMode.BUSY_WAITING) .withLoadFactor(0.8f) .build(); } else { - map = LongLongMap.newBuilder() + map = ConcurrentLongLongMap.newBuilder() .withBuckets(16) .withInitialCapacity(NUM_VALUES) .withLoadFactor(0.8f) diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/LongLongMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/LongLongMap.java deleted file mode 100644 index 8cc0a26..0000000 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/LongLongMap.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.trivago.fastutilconcurrentwrapper; - -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingLongLongMap; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongLongMap; -import it.unimi.dsi.fastutil.longs.Long2LongFunction; - -import java.util.function.BiFunction; - -public interface LongLongMap extends PrimitiveKeyMap { - boolean containsKey (long key); - - /** - * @param key long map.key - * @return defaultValue if the key is not present - */ - long get(long key); - - long put(long key, long value); - - long getDefaultValue(); - - long remove(long key); - - boolean remove(long key, long value); - - long computeIfAbsent(long key, Long2LongFunction mappingFunction); - - long computeIfPresent(long key, BiFunction mappingFunction); - - static PrimitiveMapBuilder newBuilder () { - return new PrimitiveMapBuilder<>(){ - @Override - public LongLongMap build() { - long def = defaultValue != null ? defaultValue : 0; - return switch (mapMode){ - case BUSY_WAITING -> new ConcurrentBusyWaitingLongLongMap(buckets, initialCapacity, loadFactor, def); - case BLOCKING -> new ConcurrentLongLongMap(buckets, initialCapacity, loadFactor, def); - }; - } - }; - } -} \ No newline at end of file diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongLongMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongLongMap.java index 6a77083..0963e74 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongLongMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongLongMap.java @@ -1,33 +1,13 @@ package com.trivago.fastutilconcurrentwrapper.map; -import com.trivago.fastutilconcurrentwrapper.LongLongMap; -import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.longs.Long2LongFunction; -import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap; import java.util.concurrent.locks.Lock; import java.util.function.BiFunction; -public class ConcurrentBusyWaitingLongLongMap extends PrimitiveConcurrentMap implements LongLongMap { - private final Long2LongOpenHashMap[] maps; - private final long defaultValue; - - public ConcurrentBusyWaitingLongLongMap( - int numBuckets, - int initialCapacity, - float loadFactor, - long defaultValue - ){ - super(numBuckets); - this.maps = new Long2LongOpenHashMap[numBuckets]; - this.defaultValue = defaultValue; - for (int i = 0; i < numBuckets; i++) - maps[i] = new Long2LongOpenHashMap(initialCapacity, loadFactor); - } - - @Override - protected Function mapAt (int index) { - return maps[index]; +public class ConcurrentBusyWaitingLongLongMap extends ConcurrentLongLongMap { + public ConcurrentBusyWaitingLongLongMap (int numBuckets, int initialCapacity, float loadFactor, long defaultValue) { + super(numBuckets, initialCapacity, loadFactor, defaultValue); } @Override @@ -84,8 +64,6 @@ public long put(long key, long value) { } } - @Override public long getDefaultValue (){ return defaultValue; } - @Override public long remove(long key) { int bucket = getBucket(key); diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongLongMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongLongMap.java index ac8a0da..d08a15b 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongLongMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongLongMap.java @@ -1,6 +1,6 @@ package com.trivago.fastutilconcurrentwrapper.map; -import com.trivago.fastutilconcurrentwrapper.LongLongMap; +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.longs.Long2LongFunction; import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap; @@ -8,9 +8,9 @@ import java.util.concurrent.locks.Lock; import java.util.function.BiFunction; -public class ConcurrentLongLongMap extends PrimitiveConcurrentMap implements LongLongMap { - private final Long2LongOpenHashMap[] maps; - private final long defaultValue; +public class ConcurrentLongLongMap extends PrimitiveConcurrentMap { + protected final Long2LongOpenHashMap[] maps; + protected final long defaultValue; public ConcurrentLongLongMap( int numBuckets, @@ -26,11 +26,10 @@ public ConcurrentLongLongMap( } @Override - protected Function mapAt (int index) { + protected final Function mapAt (int index) { return maps[index]; } - @Override public boolean containsKey(long key) { int bucket = getBucket(key); @@ -43,7 +42,6 @@ public boolean containsKey(long key) { } } - @Override public long get (long key) { int bucket = getBucket(key); @@ -56,7 +54,6 @@ public long get (long key) { } } - @Override public long put(long key, long value) { int bucket = getBucket(key); @@ -69,9 +66,8 @@ public long put(long key, long value) { } } - @Override public long getDefaultValue (){ return defaultValue; } + public long getDefaultValue (){ return defaultValue; } - @Override public long remove(long key) { int bucket = getBucket(key); @@ -84,7 +80,6 @@ public long remove(long key) { } } - @Override public boolean remove(long key, long value) { int bucket = getBucket(key); @@ -97,7 +92,6 @@ public boolean remove(long key, long value) { } } - @Override public long computeIfAbsent(long key, Long2LongFunction mappingFunction) { int bucket = getBucket(key); @@ -110,7 +104,6 @@ public long computeIfAbsent(long key, Long2LongFunction mappingFunction) { } } - @Override public long computeIfPresent(long key, BiFunction mappingFunction) { int bucket = getBucket(key); @@ -122,4 +115,17 @@ public long computeIfPresent(long key, BiFunction mappingFunct writeLock.unlock(); } } + + public static PrimitiveMapBuilder newBuilder () { + return new PrimitiveMapBuilder<>(){ + @Override + public ConcurrentLongLongMap build() { + long def = super.defaultValue != null ? super.defaultValue : 0; + return switch (mapMode){ + case BUSY_WAITING -> new ConcurrentBusyWaitingLongLongMap(buckets, initialCapacity, loadFactor, def); + case BLOCKING -> new ConcurrentLongLongMap(buckets, initialCapacity, loadFactor, def); + }; + } + }; + } } \ No newline at end of file diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongLongMapBuilderTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongLongMapBuilderTest.java index 1de5ac8..ed63a71 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongLongMapBuilderTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongLongMapBuilderTest.java @@ -11,14 +11,14 @@ public class ConcurrentLongLongMapBuilderTest { @Test public void simpleBuilderTest() { - var b = LongLongMap.newBuilder() + var b = ConcurrentLongLongMap.newBuilder() .withBuckets(2) .withDefaultValue(DEFAULT_VALUE) .withInitialCapacity(100) .withMode(PrimitiveMapBuilder.MapMode.BUSY_WAITING) .withLoadFactor(0.9f); - LongLongMap map = b.build(); + var map = (ConcurrentBusyWaitingLongLongMap) b.build(); map.put(1L, 10L); long v = map.get(1L); @@ -30,14 +30,14 @@ public void simpleBuilderTest() { @Test public void buildsBlockingMap() { - var b = LongLongMap.newBuilder() + var b = ConcurrentLongLongMap.newBuilder() .withBuckets(2) .withDefaultValue(DEFAULT_VALUE) .withInitialCapacity(100) .withMode(PrimitiveMapBuilder.MapMode.BLOCKING) .withLoadFactor(0.9f); - LongLongMap map = b.build(); + ConcurrentLongLongMap map = b.build(); map.put(1L, 10L); long v = map.get(1L); diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/AbstractLongLongMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/AbstractLongLongMapTest.java index a394bc9..217a4b1 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/AbstractLongLongMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/AbstractLongLongMapTest.java @@ -1,22 +1,20 @@ package com.trivago.fastutilconcurrentwrapper.longlong; import com.trivago.fastutilconcurrentwrapper.AbstractMapTest; -import com.trivago.fastutilconcurrentwrapper.LongLongMap; +import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongLongMap; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; abstract class AbstractLongLongMapTest extends AbstractMapTest { - private LongLongMap map; + private ConcurrentLongLongMap map; // Keep the default value to easily verify that this value is returned. protected long defaultValue; // Some methods return the default value of the underlying Fastutil implementation. private static final long FASTUTIL_DEFAULT_VALUE = 0L; - abstract LongLongMap createMap(); + abstract ConcurrentLongLongMap createMap (); @BeforeEach void initializeMap() { @@ -24,7 +22,7 @@ void initializeMap() { map = createMap(); } - @Test + @Test @Override protected void containsKeyReturnsFalseIfMapIsEmpty() { final long key = nextLong(); @@ -33,7 +31,7 @@ protected void containsKeyReturnsFalseIfMapIsEmpty() { assertFalse(contains); } - @Test + @Test @Override protected void containsKeyReturnsTrueIfKeyExists() { long key = nextLong(); long value = nextLong(); @@ -44,7 +42,7 @@ protected void containsKeyReturnsTrueIfKeyExists() { assertTrue(contains); } - @Test + @Test @Override protected void containsKeyReturnsFalseIfKeyWasRemoved() { long key = nextLong(); long value = nextLong(); @@ -56,14 +54,14 @@ protected void containsKeyReturnsFalseIfKeyWasRemoved() { assertFalse(contains); } - @Test + @Test @Override protected void mapIsEmptyWhenNothingWasInserted() { final boolean empty = map.isEmpty(); assertTrue(empty); } - @Test + @Test @Override protected void mapIsEmptyWhenAllKeysAreDeleted() { int entryCount = (Math.abs(nextInt()) % 100) + 1; long value = nextLong(); @@ -80,7 +78,7 @@ protected void mapIsEmptyWhenAllKeysAreDeleted() { assertTrue(empty); } - @Test + @Test @Override protected void sizeIsCorrect() { int entries = (Math.abs(nextInt()) % 50) + 1; long value = nextLong(); @@ -94,7 +92,7 @@ protected void sizeIsCorrect() { assertEquals(entries, size); } - @Test + @Test @Override protected void gettingExistingValueReturnsCorrectValue() { long key = nextLong(); long value = nextLong(); @@ -104,7 +102,7 @@ protected void gettingExistingValueReturnsCorrectValue() { assertEquals(value, returnedValue); } - @Test + @Test @Override protected void gettingNonExistingValueReturnsCorrectValue() { long key = nextLong(); final long returnedValue = map.get(key); @@ -112,7 +110,7 @@ protected void gettingNonExistingValueReturnsCorrectValue() { assertEquals(defaultValue, returnedValue); } - @Test + @Test @Override protected void removingNonExistingKeyReturnsDefaultValue() { long key = nextLong(); final long removedValue = map.remove(key); @@ -120,7 +118,7 @@ protected void removingNonExistingKeyReturnsDefaultValue() { assertEquals(FASTUTIL_DEFAULT_VALUE, removedValue); } - @Test + @Test @Override protected void removingExistingKeyReturnsPreviousValue() { long key = nextLong(); long value = nextLong(); @@ -130,7 +128,7 @@ protected void removingExistingKeyReturnsPreviousValue() { assertEquals(value, removedValue); } - @Test + @Test @Override protected void removingWithValueWhenKeyDoesNotExistReturnsFalse() { long key = nextLong(); long value = nextLong(); @@ -139,7 +137,7 @@ protected void removingWithValueWhenKeyDoesNotExistReturnsFalse() { assertFalse(result); } - @Test + @Test @Override protected void removingWithValueWhenValueIsDifferentReturnsFalse() { long key = nextLong(); long value = nextLong(); @@ -149,7 +147,7 @@ protected void removingWithValueWhenValueIsDifferentReturnsFalse() { assertFalse(result); } - @Test + @Test @Override protected void removingWithValueWhenValueIsSameReturnsTrue() { long key = nextLong(); long value = nextLong(); @@ -159,7 +157,7 @@ protected void removingWithValueWhenValueIsSameReturnsTrue() { assertTrue(result); } - @Test + @Test @Override protected void puttingValueIfAbsentReturnsSameValue() { long key = nextLong(); long value = nextLong(); @@ -170,7 +168,7 @@ protected void puttingValueIfAbsentReturnsSameValue() { assertEquals(result, value); } - @Test + @Test @Override protected void checkingValueIfNotAbsentReturnsSameValue() { long key = nextLong(); long value = nextLong(); @@ -183,7 +181,7 @@ protected void checkingValueIfNotAbsentReturnsSameValue() { assertEquals(value, returned); } - @Test + @Test @Override protected void replacingValueIfPresentReturnsNewValue() { long key = nextLong(); long value = nextLong(); @@ -196,7 +194,7 @@ protected void replacingValueIfPresentReturnsNewValue() { assertEquals(result, key + value); } - @Test + @Test @Override protected void checkingValueIfNotPresentReturnsDefaultValue() { long key = nextLong(); map.computeIfPresent(key, Long::sum); @@ -205,4 +203,4 @@ protected void checkingValueIfNotPresentReturnsDefaultValue() { assertEquals(result, map.getDefaultValue()); } -} +} \ No newline at end of file diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentBusyWaitingLongLongMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentBusyWaitingLongLongMapTest.java index 87c55f3..0f51fec 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentBusyWaitingLongLongMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentBusyWaitingLongLongMapTest.java @@ -1,12 +1,11 @@ package com.trivago.fastutilconcurrentwrapper.longlong; -import com.trivago.fastutilconcurrentwrapper.LongLongMap; import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingLongLongMap; public class ConcurrentBusyWaitingLongLongMapTest extends AbstractLongLongMapTest { @Override - LongLongMap createMap() { + ConcurrentBusyWaitingLongLongMap createMap() { return new ConcurrentBusyWaitingLongLongMap(16, 16, 0.9F, defaultValue); } -} +} \ No newline at end of file diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentLongLongMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentLongLongMapTest.java index 32830be..2b1b2fd 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentLongLongMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentLongLongMapTest.java @@ -1,12 +1,11 @@ package com.trivago.fastutilconcurrentwrapper.longlong; -import com.trivago.fastutilconcurrentwrapper.LongLongMap; import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongLongMap; public class ConcurrentLongLongMapTest extends AbstractLongLongMapTest { @Override - LongLongMap createMap() { + ConcurrentLongLongMap createMap() { return new ConcurrentLongLongMap(16, 16, 0.9F, defaultValue); } -} +} \ No newline at end of file diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/PrimitiveFastutilLongLongWrapperTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/PrimitiveFastutilLongLongWrapperTest.java index 78f81de..1e63bdd 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/PrimitiveFastutilLongLongWrapperTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/PrimitiveFastutilLongLongWrapperTest.java @@ -1,12 +1,10 @@ package com.trivago.fastutilconcurrentwrapper.longlong; -import com.trivago.fastutilconcurrentwrapper.LongLongMap; import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongLongMap; public class PrimitiveFastutilLongLongWrapperTest extends AbstractLongLongMapTest { - @Override - LongLongMap createMap() { + ConcurrentLongLongMap createMap() { return new ConcurrentLongLongMap(1, 5, 0.9F, defaultValue); } } \ No newline at end of file From c7138e5df2f2215ad8be2d316a2511191f1fbda2 Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 14:34:28 +0300 Subject: [PATCH 02/17] =?UTF-8?q?"zero=20fat"=20edition=20LongIntMap?= =?UTF-8?q?=E2=86=92ConcurrentLongIntMap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fastutilconcurrentwrapper/LongIntMap.java | 42 ------------------- .../map/ConcurrentBusyWaitingLongIntMap.java | 28 ++----------- .../map/ConcurrentLongIntMap.java | 32 ++++++++------ .../ConcurrentLongIntMapBuilderTest.java | 8 ++-- .../longint/AbstractLongIntMapTest.java | 14 +++---- .../ConcurrentBusyWaitingLongIntMapTest.java | 6 +-- .../ConcurrentPrimitiveLongIntMapTest.java | 6 +-- .../PrimitiveFastutilLongIntWrapperTest.java | 4 +- 8 files changed, 36 insertions(+), 104 deletions(-) delete mode 100644 src/main/java/com/trivago/fastutilconcurrentwrapper/LongIntMap.java diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/LongIntMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/LongIntMap.java deleted file mode 100644 index 533e174..0000000 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/LongIntMap.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.trivago.fastutilconcurrentwrapper; - -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingLongIntMap; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongIntMap; -import it.unimi.dsi.fastutil.longs.Long2IntFunction; - -import java.util.function.BiFunction; - -public interface LongIntMap extends PrimitiveKeyMap { - boolean containsKey (long key); - - /** - * @param key key to get - * @return configured LongIntMap.getDefaultValue(), if the key is not present - */ - int get(long key); - - int put(long key, int value); - - int getDefaultValue(); - - int remove(long key); - - boolean remove(long key, int value); - - int computeIfAbsent(long key, Long2IntFunction mappingFunction); - - int computeIfPresent(long key, BiFunction mappingFunction); - - static PrimitiveMapBuilder newBuilder () { - return new PrimitiveMapBuilder<>(){ - @Override - public LongIntMap build() { - int def = defaultValue != null ? defaultValue : 0; - return switch (mapMode){ - case BUSY_WAITING -> new ConcurrentBusyWaitingLongIntMap(buckets, initialCapacity, loadFactor, def); - case BLOCKING -> new ConcurrentLongIntMap(buckets, initialCapacity, loadFactor, def); - }; - } - }; - } -} \ No newline at end of file diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongIntMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongIntMap.java index 778b796..181d09b 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongIntMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongIntMap.java @@ -1,33 +1,13 @@ package com.trivago.fastutilconcurrentwrapper.map; -import com.trivago.fastutilconcurrentwrapper.LongIntMap; -import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.longs.Long2IntFunction; -import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap; import java.util.concurrent.locks.Lock; import java.util.function.BiFunction; -public class ConcurrentBusyWaitingLongIntMap extends PrimitiveConcurrentMap implements LongIntMap { - private final Long2IntOpenHashMap[] maps; - private final int defaultValue; - - public ConcurrentBusyWaitingLongIntMap( - int numBuckets, - int initialCapacity, - float loadFactor, - int defaultValue - ){ - super(numBuckets); - this.maps = new Long2IntOpenHashMap[numBuckets]; - this.defaultValue = defaultValue; - for (int i = 0; i < numBuckets; i++) - maps[i] = new Long2IntOpenHashMap(initialCapacity, loadFactor); - } - - @Override - protected Function mapAt (int index) { - return maps[index]; +public class ConcurrentBusyWaitingLongIntMap extends ConcurrentLongIntMap { + public ConcurrentBusyWaitingLongIntMap (int numBuckets, int initialCapacity, float loadFactor, int defaultValue) { + super(numBuckets, initialCapacity, loadFactor, defaultValue); } @Override @@ -84,8 +64,6 @@ public int put(long key, int value) { } } - @Override public int getDefaultValue (){ return defaultValue; } - @Override public int remove(long key) { int bucket = getBucket(key); diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongIntMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongIntMap.java index 06e33bb..4289bfa 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongIntMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongIntMap.java @@ -1,6 +1,6 @@ package com.trivago.fastutilconcurrentwrapper.map; -import com.trivago.fastutilconcurrentwrapper.LongIntMap; +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.longs.Long2IntFunction; import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap; @@ -8,11 +8,11 @@ import java.util.concurrent.locks.Lock; import java.util.function.BiFunction; -public class ConcurrentLongIntMap extends PrimitiveConcurrentMap implements LongIntMap { - private final Long2IntOpenHashMap[] maps; - private final int defaultValue; +public class ConcurrentLongIntMap extends PrimitiveConcurrentMap { + protected final Long2IntOpenHashMap[] maps; + protected final int defaultValue; - public ConcurrentLongIntMap( + public ConcurrentLongIntMap ( int numBuckets, int initialCapacity, float loadFactor, @@ -30,7 +30,6 @@ protected Function mapAt (int index) { return maps[index]; } - @Override public boolean containsKey(long key) { int bucket = getBucket(key); @@ -43,7 +42,6 @@ public boolean containsKey(long key) { } } - @Override public int get(long key) { int bucket = getBucket(key); @@ -56,7 +54,6 @@ public int get(long key) { } } - @Override public int put(long key, int value) { int bucket = getBucket(key); @@ -69,9 +66,8 @@ public int put(long key, int value) { } } - @Override public int getDefaultValue (){ return defaultValue; } + public int getDefaultValue (){ return defaultValue; } - @Override public int remove(long key) { int bucket = getBucket(key); @@ -84,7 +80,6 @@ public int remove(long key) { } } - @Override public boolean remove(long key, int value) { int bucket = getBucket(key); @@ -97,7 +92,6 @@ public boolean remove(long key, int value) { } } - @Override public int computeIfAbsent(long key, Long2IntFunction mappingFunction) { int bucket = getBucket(key); @@ -110,7 +104,6 @@ public int computeIfAbsent(long key, Long2IntFunction mappingFunction) { } } - @Override public int computeIfPresent(long key, BiFunction mappingFunction) { int bucket = getBucket(key); @@ -122,4 +115,17 @@ public int computeIfPresent(long key, BiFunction mapping writeLock.unlock(); } } + + public static PrimitiveMapBuilder newBuilder () { + return new PrimitiveMapBuilder<>(){ + @Override + public ConcurrentLongIntMap build() { + int def = super.defaultValue != null ? super.defaultValue : 0; + return switch (mapMode){ + case BUSY_WAITING -> new ConcurrentBusyWaitingLongIntMap(buckets, initialCapacity, loadFactor, def); + case BLOCKING -> new ConcurrentLongIntMap(buckets, initialCapacity, loadFactor, def); + }; + } + }; + } } \ No newline at end of file diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongIntMapBuilderTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongIntMapBuilderTest.java index 63bef79..c4a7279 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongIntMapBuilderTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongIntMapBuilderTest.java @@ -11,14 +11,14 @@ public class ConcurrentLongIntMapBuilderTest { @Test public void buildsBusyWaitingMap() { - var b = LongIntMap.newBuilder() + var b = ConcurrentLongIntMap.newBuilder() .withBuckets(2) .withDefaultValue(DEFAULT_VALUE) .withInitialCapacity(100) .withMode(PrimitiveMapBuilder.MapMode.BUSY_WAITING) .withLoadFactor(0.9f); - LongIntMap map = b.build(); + ConcurrentLongIntMap map = b.build(); map.put(1L, 10); int v = map.get(1L); @@ -30,14 +30,14 @@ public void buildsBusyWaitingMap() { @Test public void buildsBlockingMap() { - var b = LongIntMap.newBuilder() + var b = ConcurrentLongIntMap.newBuilder() .withBuckets(2) .withDefaultValue(DEFAULT_VALUE) .withInitialCapacity(100) .withMode(PrimitiveMapBuilder.MapMode.BLOCKING) .withLoadFactor(0.9f); - LongIntMap map = b.build(); + ConcurrentLongIntMap map = b.build(); map.put(1L, 10); long v = map.get(1L); diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/AbstractLongIntMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/AbstractLongIntMapTest.java index ce42f0c..fa6300e 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/AbstractLongIntMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/AbstractLongIntMapTest.java @@ -1,23 +1,19 @@ package com.trivago.fastutilconcurrentwrapper.longint; import com.trivago.fastutilconcurrentwrapper.AbstractMapTest; -import com.trivago.fastutilconcurrentwrapper.LongIntMap; +import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongIntMap; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.*; abstract class AbstractLongIntMapTest extends AbstractMapTest { // Some methods return the default value of the underlying Fastutil implementation. private static final int FASTUTIL_DEFAULT_VALUE = 0; - protected int defaultValue; - private LongIntMap map; + private ConcurrentLongIntMap map; // Keep the default value to easily verify that this value is returned. - - abstract LongIntMap createMap(); + abstract ConcurrentLongIntMap createMap (); @BeforeEach void initializeMap() { @@ -206,4 +202,4 @@ protected void checkingValueIfNotPresentReturnsDefaultValue() { assertEquals(result, map.getDefaultValue()); } -} +} \ No newline at end of file diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentBusyWaitingLongIntMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentBusyWaitingLongIntMapTest.java index 471b17f..8e41356 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentBusyWaitingLongIntMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentBusyWaitingLongIntMapTest.java @@ -1,12 +1,10 @@ package com.trivago.fastutilconcurrentwrapper.longint; -import com.trivago.fastutilconcurrentwrapper.LongIntMap; import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingLongIntMap; public class ConcurrentBusyWaitingLongIntMapTest extends AbstractLongIntMapTest { - @Override - LongIntMap createMap() { + ConcurrentBusyWaitingLongIntMap createMap() { return new ConcurrentBusyWaitingLongIntMap(16, 16, 0.9F, defaultValue); } -} +} \ No newline at end of file diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentPrimitiveLongIntMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentPrimitiveLongIntMapTest.java index 0046d77..0c7feee 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentPrimitiveLongIntMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentPrimitiveLongIntMapTest.java @@ -1,13 +1,11 @@ package com.trivago.fastutilconcurrentwrapper.longint; -import com.trivago.fastutilconcurrentwrapper.LongIntMap; import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongIntMap; public class ConcurrentPrimitiveLongIntMapTest extends AbstractLongIntMapTest { @Override - LongIntMap createMap() { + ConcurrentLongIntMap createMap() { return new ConcurrentLongIntMap(16, 16, 0.9F, defaultValue); } - -} +} \ No newline at end of file diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/PrimitiveFastutilLongIntWrapperTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/PrimitiveFastutilLongIntWrapperTest.java index 3298fe8..fe27ff4 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/PrimitiveFastutilLongIntWrapperTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/PrimitiveFastutilLongIntWrapperTest.java @@ -1,12 +1,10 @@ package com.trivago.fastutilconcurrentwrapper.longint; -import com.trivago.fastutilconcurrentwrapper.LongIntMap; import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongIntMap; public class PrimitiveFastutilLongIntWrapperTest extends AbstractLongIntMapTest { - @Override - LongIntMap createMap() { + ConcurrentLongIntMap createMap() { return new ConcurrentLongIntMap(1, 5, 0.9F, defaultValue); } } \ No newline at end of file From ecdefa1e6247225ec721e97f08da1f29bf546951 Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 14:38:17 +0300 Subject: [PATCH 03/17] =?UTF-8?q?"zero=20fat"=20edition=20IntIntMap?= =?UTF-8?q?=E2=86=92ConcurrentIntIntMap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fastutilconcurrentwrapper/IntIntMap.java | 42 ------------------- .../map/ConcurrentBusyWaitingIntIntMap.java | 28 ++----------- .../map/ConcurrentIntIntMap.java | 30 +++++++------ .../ConcurrentIntIntMapBuilderTest.java | 9 ++-- 4 files changed, 26 insertions(+), 83 deletions(-) delete mode 100644 src/main/java/com/trivago/fastutilconcurrentwrapper/IntIntMap.java diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/IntIntMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/IntIntMap.java deleted file mode 100644 index 33545ec..0000000 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/IntIntMap.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.trivago.fastutilconcurrentwrapper; - -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingIntIntMap; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentIntIntMap; -import it.unimi.dsi.fastutil.ints.Int2IntFunction; - -import java.util.function.BiFunction; - -public interface IntIntMap extends PrimitiveKeyMap { - boolean containsKey(int key); - - /** - * @param key int Map.key - * @return defaultValue if the key is not present - */ - int get(int key); - - int put(int key, int value); - - int getDefaultValue(); - - int remove(int key); - - boolean remove(int key, int value); - - int computeIfAbsent(int key, Int2IntFunction mappingFunction); - - int computeIfPresent(int key, BiFunction mappingFunction); - - static PrimitiveMapBuilder newBuilder () { - return new PrimitiveMapBuilder<>(){ - @Override - public IntIntMap build () { - int def = defaultValue != null ? defaultValue : 0; - return switch (mapMode){ - case BUSY_WAITING -> new ConcurrentBusyWaitingIntIntMap(buckets, initialCapacity, loadFactor, def); - case BLOCKING -> new ConcurrentIntIntMap(buckets, initialCapacity, loadFactor, def); - }; - } - }; - } -} \ No newline at end of file diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntIntMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntIntMap.java index c97acd1..3a9e378 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntIntMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntIntMap.java @@ -1,33 +1,13 @@ package com.trivago.fastutilconcurrentwrapper.map; -import com.trivago.fastutilconcurrentwrapper.IntIntMap; -import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.ints.Int2IntFunction; -import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; import java.util.concurrent.locks.Lock; import java.util.function.BiFunction; -public class ConcurrentBusyWaitingIntIntMap extends PrimitiveConcurrentMap implements IntIntMap { - private final Int2IntOpenHashMap[] maps; - private final int defaultValue; - - public ConcurrentBusyWaitingIntIntMap( - int numBuckets, - int initialCapacity, - float loadFactor, - int defaultValue - ){ - super(numBuckets); - this.maps = new Int2IntOpenHashMap[numBuckets]; - this.defaultValue = defaultValue; - for (int i = 0; i < numBuckets; i++) - maps[i] = new Int2IntOpenHashMap(initialCapacity, loadFactor); - } - - @Override - protected Function mapAt (int index) { - return maps[index]; +public class ConcurrentBusyWaitingIntIntMap extends ConcurrentIntIntMap { + public ConcurrentBusyWaitingIntIntMap (int numBuckets, int initialCapacity, float loadFactor, int defaultValue) { + super(numBuckets, initialCapacity, loadFactor, defaultValue); } @Override @@ -84,8 +64,6 @@ public int put(int key, int value) { } } - @Override public int getDefaultValue (){ return defaultValue; } - @Override public int remove(int key) { int bucket = getBucket(key); diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntIntMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntIntMap.java index 5616322..7c8c158 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntIntMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntIntMap.java @@ -1,6 +1,6 @@ package com.trivago.fastutilconcurrentwrapper.map; -import com.trivago.fastutilconcurrentwrapper.IntIntMap; +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.ints.Int2IntFunction; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; @@ -8,9 +8,9 @@ import java.util.concurrent.locks.Lock; import java.util.function.BiFunction; -public class ConcurrentIntIntMap extends PrimitiveConcurrentMap implements IntIntMap { - private final Int2IntOpenHashMap[] maps; - private final int defaultValue; +public class ConcurrentIntIntMap extends PrimitiveConcurrentMap { + protected final Int2IntOpenHashMap[] maps; + protected final int defaultValue; public ConcurrentIntIntMap( int numBuckets, @@ -30,7 +30,6 @@ protected Function mapAt (int index) { return maps[index]; } - @Override public boolean containsKey(int key) { int bucket = getBucket(key); @@ -43,7 +42,6 @@ public boolean containsKey(int key) { } } - @Override public int get (int key) { int bucket = getBucket(key); @@ -56,7 +54,6 @@ public int get (int key) { } } - @Override public int put(int key, int value) { int bucket = getBucket(key); @@ -69,9 +66,8 @@ public int put(int key, int value) { } } - @Override public int getDefaultValue (){ return defaultValue; } + public int getDefaultValue (){ return defaultValue; } - @Override public int remove(int key) { int bucket = getBucket(key); @@ -84,7 +80,6 @@ public int remove(int key) { } } - @Override public boolean remove(int key, int value) { int bucket = getBucket(key); @@ -97,7 +92,6 @@ public boolean remove(int key, int value) { } } - @Override public int computeIfAbsent(int key, Int2IntFunction mappingFunction) { int bucket = getBucket(key); @@ -110,7 +104,6 @@ public int computeIfAbsent(int key, Int2IntFunction mappingFunction) { } } - @Override public int computeIfPresent(int key, BiFunction mappingFunction) { int bucket = getBucket(key); @@ -122,4 +115,17 @@ public int computeIfPresent(int key, BiFunction mappi writeLock.unlock(); } } + + public static PrimitiveMapBuilder newBuilder () { + return new PrimitiveMapBuilder<>(){ + @Override + public ConcurrentIntIntMap build () { + int def = super.defaultValue != null ? super.defaultValue : 0; + return switch (mapMode){ + case BUSY_WAITING -> new ConcurrentBusyWaitingIntIntMap(buckets, initialCapacity, loadFactor, def); + case BLOCKING -> new ConcurrentIntIntMap(buckets, initialCapacity, loadFactor, def); + }; + } + }; + } } \ No newline at end of file diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntIntMapBuilderTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntIntMapBuilderTest.java index 3b22299..9088f15 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntIntMapBuilderTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntIntMapBuilderTest.java @@ -11,14 +11,14 @@ public class ConcurrentIntIntMapBuilderTest { @Test public void buildsBusyWaitingMap() { - var b = IntIntMap.newBuilder() + var b = ConcurrentIntIntMap.newBuilder() .withBuckets(2) .withDefaultValue(DEFAULT_VALUE) .withInitialCapacity(100) .withMode(PrimitiveMapBuilder.MapMode.BUSY_WAITING) .withLoadFactor(0.8f); - IntIntMap map = b.build(); + ConcurrentIntIntMap map = b.build(); map.put(1, 10); int v = map.get(1); @@ -30,19 +30,20 @@ public void buildsBusyWaitingMap() { @Test public void buildsBlockingMap() { - var b = IntIntMap.newBuilder() + var b = ConcurrentIntIntMap.newBuilder() .withBuckets(2) .withDefaultValue(DEFAULT_VALUE) .withInitialCapacity(100) .withMode(PrimitiveMapBuilder.MapMode.BLOCKING) .withLoadFactor(0.8f); - IntIntMap map = b.build(); + ConcurrentIntIntMap map = b.build(); map.put(1, 10); int v = map.get(1); assertInstanceOf(ConcurrentIntIntMap.class, map); + assertSame(ConcurrentIntIntMap.class, map.getClass()); assertEquals(10, v); assertEquals(map.get(2), map.getDefaultValue()); } From 31d23ff595cb61a671117d7cd1210487d5d1623f Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 14:42:41 +0300 Subject: [PATCH 04/17] =?UTF-8?q?"zero=20fat"=20edition=20IntFloatMap?= =?UTF-8?q?=E2=86=92ConcurrentIntFloatMap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IntFloatMap.java | 38 ----------------- .../map/ConcurrentBusyWaitingIntFloatMap.java | 42 +++++-------------- .../map/ConcurrentIntFloatMap.java | 30 +++++++------ .../ConcurrentIntFloatMapBuilderTest.java | 9 ++-- .../ConcurrentBusyWaitingIntFloatMapTest.java | 3 +- 5 files changed, 34 insertions(+), 88 deletions(-) delete mode 100644 src/main/java/com/trivago/fastutilconcurrentwrapper/IntFloatMap.java diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/IntFloatMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/IntFloatMap.java deleted file mode 100644 index c2ece40..0000000 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/IntFloatMap.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.trivago.fastutilconcurrentwrapper; - -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingIntFloatMap; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentIntFloatMap; -import it.unimi.dsi.fastutil.ints.Int2FloatFunction; - -import java.util.function.BiFunction; - -public interface IntFloatMap extends PrimitiveKeyMap { - boolean containsKey(int key); - - float get(int key); - - float put(int key, float value); - - float getDefaultValue(); - - float remove(int key); - - boolean remove(int key, float value); - - float computeIfAbsent(int key, Int2FloatFunction mappingFunction); - - float computeIfPresent(int key, BiFunction mappingFunction); - - static PrimitiveMapBuilder newBuilder () { - return new PrimitiveMapBuilder<>(){ - @Override - public IntFloatMap build () { - float def = defaultValue != null ? defaultValue : 0; - return switch (mapMode){ - case BUSY_WAITING -> new ConcurrentBusyWaitingIntFloatMap(buckets, initialCapacity, loadFactor, def); - case BLOCKING -> new ConcurrentIntFloatMap(buckets, initialCapacity, loadFactor, def); - }; - } - }; - } -} \ No newline at end of file diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMap.java index 9d39c9b..5f0238d 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMap.java @@ -1,37 +1,17 @@ package com.trivago.fastutilconcurrentwrapper.map; -import com.trivago.fastutilconcurrentwrapper.IntFloatMap; -import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.ints.Int2FloatFunction; -import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap; import java.util.concurrent.locks.Lock; import java.util.function.BiFunction; -public class ConcurrentBusyWaitingIntFloatMap extends PrimitiveConcurrentMap implements IntFloatMap { - private final Int2FloatOpenHashMap[] maps; - private final float defaultValue; - - public ConcurrentBusyWaitingIntFloatMap( - int numBuckets, - int initialCapacity, - float loadFactor, - float defaultValue - ){ - super(numBuckets); - this.maps = new Int2FloatOpenHashMap[numBuckets]; - this.defaultValue = defaultValue; - for (int i = 0; i < numBuckets; i++) - maps[i] = new Int2FloatOpenHashMap(initialCapacity, loadFactor); +public class ConcurrentBusyWaitingIntFloatMap extends ConcurrentIntFloatMap { + public ConcurrentBusyWaitingIntFloatMap (int numBuckets, int initialCapacity, float loadFactor, float defaultValue) { + super(numBuckets, initialCapacity, loadFactor, defaultValue); } @Override - protected Function mapAt (int index) { - return maps[index]; - } - - @Override - public boolean containsKey(int key) { + public boolean containsKey(int key) { int bucket = getBucket(key); Lock readLock = locks[bucket].readLock(); @@ -49,7 +29,7 @@ public boolean containsKey(int key) { } @Override - public float get(int key) { + public float get (int key) { int bucket = getBucket(key); Lock readLock = locks[bucket].readLock(); @@ -67,7 +47,7 @@ public float get(int key) { } @Override - public float put(int key, float value) { + public float put(int key, float value) { int bucket = getBucket(key); Lock writeLock = locks[bucket].writeLock(); @@ -84,10 +64,8 @@ public float put(int key, float value) { } } - @Override public float getDefaultValue (){ return defaultValue; } - @Override - public float remove(int key) { + public float remove(int key) { int bucket = getBucket(key); Lock writeLock = locks[bucket].writeLock(); @@ -105,7 +83,7 @@ public float remove(int key) { } @Override - public boolean remove(int key, float value) { + public boolean remove(int key, float value) { int bucket = getBucket(key); Lock writeLock = locks[bucket].writeLock(); @@ -123,7 +101,7 @@ public boolean remove(int key, float value) { } @Override - public float computeIfAbsent(int key, Int2FloatFunction mappingFunction) { + public float computeIfAbsent(int key, Int2FloatFunction mappingFunction) { int bucket = getBucket(key); Lock writeLock = locks[bucket].writeLock(); @@ -141,7 +119,7 @@ public float computeIfAbsent(int key, Int2FloatFunction mappingFunction) { } @Override - public float computeIfPresent(int key, BiFunction mappingFunction) { + public float computeIfPresent(int key, BiFunction mappingFunction) { int bucket = getBucket(key); Lock writeLock = locks[bucket].writeLock(); diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntFloatMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntFloatMap.java index 76043b7..7dcad69 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntFloatMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntFloatMap.java @@ -1,6 +1,6 @@ package com.trivago.fastutilconcurrentwrapper.map; -import com.trivago.fastutilconcurrentwrapper.IntFloatMap; +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.ints.Int2FloatFunction; import it.unimi.dsi.fastutil.ints.Int2FloatOpenHashMap; @@ -8,9 +8,9 @@ import java.util.concurrent.locks.Lock; import java.util.function.BiFunction; -public class ConcurrentIntFloatMap extends PrimitiveConcurrentMap implements IntFloatMap { - private final Int2FloatOpenHashMap[] maps; - private final float defaultValue; +public class ConcurrentIntFloatMap extends PrimitiveConcurrentMap { + protected final Int2FloatOpenHashMap[] maps; + protected final float defaultValue; public ConcurrentIntFloatMap( int numBuckets, @@ -30,7 +30,6 @@ protected Function mapAt (int index) { return maps[index]; } - @Override public boolean containsKey(int key) { int bucket = getBucket(key); @@ -43,7 +42,6 @@ public boolean containsKey(int key) { } } - @Override public float get(int key) { int bucket = getBucket(key); @@ -56,7 +54,6 @@ public float get(int key) { } } - @Override public float put(int key, float value) { int bucket = getBucket(key); @@ -69,9 +66,8 @@ public float put(int key, float value) { } } - @Override public float getDefaultValue (){ return defaultValue; } + public float getDefaultValue (){ return defaultValue; } - @Override public float remove(int key) { int bucket = getBucket(key); @@ -84,7 +80,6 @@ public float remove(int key) { } } - @Override public boolean remove(int key, float value) { int bucket = getBucket(key); @@ -97,7 +92,6 @@ public boolean remove(int key, float value) { } } - @Override public float computeIfAbsent(int key, Int2FloatFunction mappingFunction) { int bucket = getBucket(key); @@ -110,7 +104,6 @@ public float computeIfAbsent(int key, Int2FloatFunction mappingFunction) { } } - @Override public float computeIfPresent(int key, BiFunction mappingFunction) { int bucket = getBucket(key); @@ -122,4 +115,17 @@ public float computeIfPresent(int key, BiFunction mapping writeLock.unlock(); } } + + public static PrimitiveMapBuilder newBuilder () { + return new PrimitiveMapBuilder<>(){ + @Override + public ConcurrentIntFloatMap build () { + float def = super.defaultValue != null ? super.defaultValue : 0; + return switch (mapMode){ + case BUSY_WAITING -> new ConcurrentBusyWaitingIntFloatMap(buckets, initialCapacity, loadFactor, def); + case BLOCKING -> new ConcurrentIntFloatMap(buckets, initialCapacity, loadFactor, def); + }; + } + }; + } } \ No newline at end of file diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntFloatMapBuilderTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntFloatMapBuilderTest.java index 8e3bc2f..93f08ee 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntFloatMapBuilderTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntFloatMapBuilderTest.java @@ -11,14 +11,14 @@ public class ConcurrentIntFloatMapBuilderTest { @Test public void buildsBusyWaitingMap() { - var b = IntFloatMap.newBuilder() + var b = ConcurrentIntFloatMap.newBuilder() .withBuckets(2) .withDefaultValue(DEFAULT_VALUE) .withInitialCapacity(100) .withMode(PrimitiveMapBuilder.MapMode.BUSY_WAITING) .withLoadFactor(0.8f); - IntFloatMap map = b.build(); + ConcurrentIntFloatMap map = b.build(); map.put(1, 10.1f); float v = map.get(1); @@ -30,19 +30,20 @@ public void buildsBusyWaitingMap() { @Test public void buildsBlockingMap() { - var b = IntFloatMap.newBuilder() + var b = ConcurrentIntFloatMap.newBuilder() .withBuckets(2) .withDefaultValue(DEFAULT_VALUE) .withInitialCapacity(100) .withMode(PrimitiveMapBuilder.MapMode.BLOCKING) .withLoadFactor(0.8f); - IntFloatMap map = b.build(); + ConcurrentIntFloatMap map = b.build(); map.put(1, 10.1f); float v = map.get(1); assertInstanceOf(ConcurrentIntFloatMap.class, map); + assertSame(ConcurrentIntFloatMap.class, map.getClass()); assertEquals(10.1f, v); assertEquals(map.get(2), map.getDefaultValue()); } diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMapTest.java index 52dec90..6609f59 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMapTest.java @@ -1,6 +1,5 @@ package com.trivago.fastutilconcurrentwrapper.map; -import com.trivago.fastutilconcurrentwrapper.IntFloatMap; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; @@ -10,7 +9,7 @@ class ConcurrentBusyWaitingIntFloatMapTest { @Test void basic () { - for (var m : new IntFloatMap[]{new ConcurrentBusyWaitingIntFloatMap(10, 11, 0.5f, -1), new ConcurrentIntFloatMap(10, 11, 0.5f, -1)}){ + for (var m : new ConcurrentIntFloatMap[]{new ConcurrentBusyWaitingIntFloatMap(10, 11, 0.5f, -1), new ConcurrentIntFloatMap(10, 11, 0.5f, -1)}){ assertEquals(-1.0f, m.getDefaultValue()); assertEquals(0, m.size()); assertFalse(m.containsKey(42)); From 2a5a668a9ed23260045bf405c4d3aa820dbe1045 Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 14:46:38 +0300 Subject: [PATCH 05/17] =?UTF-8?q?"zero=20fat"=20edition=20LongFloatMap?= =?UTF-8?q?=E2=86=92ConcurrentLongFloatMap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LongFloatMap.java | 49 ------------------- .../ConcurrentBusyWaitingLongFloatMap.java | 28 ++--------- .../map/ConcurrentLongFloatMap.java | 30 +++++++----- .../ConcurrentLongFloatMapBuilderTest.java | 9 ++-- 4 files changed, 26 insertions(+), 90 deletions(-) delete mode 100644 src/main/java/com/trivago/fastutilconcurrentwrapper/LongFloatMap.java diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/LongFloatMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/LongFloatMap.java deleted file mode 100644 index 62ea880..0000000 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/LongFloatMap.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.trivago.fastutilconcurrentwrapper; - -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingLongFloatMap; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongFloatMap; -import it.unimi.dsi.fastutil.longs.Long2FloatFunction; - -import java.util.function.BiFunction; - -public interface LongFloatMap extends PrimitiveKeyMap { - boolean containsKey (long key); - - /** - * @param key key - * @return 0.0 if the key is not present - */ - float get(long key); - - float put(long key, float value); - - float getDefaultValue(); - - float remove(long key); - - /** - * Remove this key only if it has the given value. - * - * @param key - * @param value - * @return - */ - boolean remove(long key, float value); - - float computeIfAbsent(long key, Long2FloatFunction mappingFunction); - - float computeIfPresent(int key, BiFunction mappingFunction); - - static PrimitiveMapBuilder newBuilder () { - return new PrimitiveMapBuilder<>(){ - @Override - public LongFloatMap build () { - float def = defaultValue != null ? defaultValue : 0; - return switch (mapMode){ - case BUSY_WAITING -> new ConcurrentBusyWaitingLongFloatMap(buckets, initialCapacity, loadFactor, def); - case BLOCKING -> new ConcurrentLongFloatMap(buckets, initialCapacity, loadFactor, def); - }; - } - }; - } -} \ No newline at end of file diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongFloatMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongFloatMap.java index 2f6f5f6..a1a8582 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongFloatMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongFloatMap.java @@ -1,33 +1,13 @@ package com.trivago.fastutilconcurrentwrapper.map; -import com.trivago.fastutilconcurrentwrapper.LongFloatMap; -import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.longs.Long2FloatFunction; -import it.unimi.dsi.fastutil.longs.Long2FloatOpenHashMap; import java.util.concurrent.locks.Lock; import java.util.function.BiFunction; -public class ConcurrentBusyWaitingLongFloatMap extends PrimitiveConcurrentMap implements LongFloatMap { - private final Long2FloatOpenHashMap[] maps; - private final float defaultValue; - - public ConcurrentBusyWaitingLongFloatMap( - int numBuckets, - int initialCapacity, - float loadFactor, - float defaultValue - ){ - super(numBuckets); - this.defaultValue = defaultValue; - this.maps = new Long2FloatOpenHashMap[numBuckets]; - for (int i = 0; i < numBuckets; i++) - maps[i] = new Long2FloatOpenHashMap(initialCapacity, loadFactor); - } - - @Override - protected Function mapAt (int index) { - return maps[index]; +public class ConcurrentBusyWaitingLongFloatMap extends ConcurrentLongFloatMap { + public ConcurrentBusyWaitingLongFloatMap (int numBuckets, int initialCapacity, float loadFactor, float defaultValue) { + super(numBuckets, initialCapacity, loadFactor, defaultValue); } @Override @@ -84,8 +64,6 @@ public float put(long key, float value) { } } - @Override public float getDefaultValue (){ return defaultValue; } - @Override public float remove(long key) { int bucket = getBucket(key); diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongFloatMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongFloatMap.java index 86cf126..703af88 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongFloatMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongFloatMap.java @@ -1,6 +1,6 @@ package com.trivago.fastutilconcurrentwrapper.map; -import com.trivago.fastutilconcurrentwrapper.LongFloatMap; +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.longs.Long2FloatFunction; import it.unimi.dsi.fastutil.longs.Long2FloatOpenHashMap; @@ -8,9 +8,9 @@ import java.util.concurrent.locks.Lock; import java.util.function.BiFunction; -public class ConcurrentLongFloatMap extends PrimitiveConcurrentMap implements LongFloatMap { - private final Long2FloatOpenHashMap[] maps; - private final float defaultValue; +public class ConcurrentLongFloatMap extends PrimitiveConcurrentMap { + protected final Long2FloatOpenHashMap[] maps; + protected final float defaultValue; public ConcurrentLongFloatMap ( int numBuckets, @@ -25,14 +25,13 @@ public ConcurrentLongFloatMap ( maps[i] = new Long2FloatOpenHashMap(initialCapacity, loadFactor); } - @Override public float getDefaultValue (){ return defaultValue; } + public float getDefaultValue (){ return defaultValue; } @Override protected Function mapAt (int index) { return maps[index]; } - @Override public boolean containsKey(long key) { int bucket = getBucket(key); @@ -45,7 +44,6 @@ public boolean containsKey(long key) { } } - @Override public float get(long key) { int bucket = getBucket(key); @@ -58,7 +56,6 @@ public float get(long key) { } } - @Override public float put(long key, float value) { int bucket = getBucket(key); @@ -71,7 +68,6 @@ public float put(long key, float value) { } } - @Override public float remove(long key) { int bucket = getBucket(key); @@ -84,7 +80,6 @@ public float remove(long key) { } } - @Override public boolean remove(long key, float value) { int bucket = getBucket(key); @@ -97,7 +92,6 @@ public boolean remove(long key, float value) { } } - @Override public float computeIfAbsent(long key, Long2FloatFunction mappingFunction) { int bucket = getBucket(key); @@ -110,7 +104,6 @@ public float computeIfAbsent(long key, Long2FloatFunction mappingFunction) { } } - @Override public float computeIfPresent(int key, BiFunction mappingFunction) { int bucket = getBucket(key); @@ -122,4 +115,17 @@ public float computeIfPresent(int key, BiFunction mappingFun writeLock.unlock(); } } + + public static PrimitiveMapBuilder newBuilder () { + return new PrimitiveMapBuilder<>(){ + @Override + public ConcurrentLongFloatMap build () { + float def = super.defaultValue != null ? super.defaultValue : 0; + return switch (mapMode){ + case BUSY_WAITING -> new ConcurrentBusyWaitingLongFloatMap(buckets, initialCapacity, loadFactor, def); + case BLOCKING -> new ConcurrentLongFloatMap(buckets, initialCapacity, loadFactor, def); + }; + } + }; + } } \ No newline at end of file diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongFloatMapBuilderTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongFloatMapBuilderTest.java index f02d72d..3992818 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongFloatMapBuilderTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongFloatMapBuilderTest.java @@ -11,14 +11,14 @@ public class ConcurrentLongFloatMapBuilderTest { @Test public void buildsBusyWaitingMap() { - var b = LongFloatMap.newBuilder() + var b = ConcurrentLongFloatMap.newBuilder() .withBuckets(2) .withDefaultValue(DEFAULT_VALUE) .withInitialCapacity(100) .withMode(PrimitiveMapBuilder.MapMode.BUSY_WAITING) .withLoadFactor(0.8f); - LongFloatMap map = b.build(); + ConcurrentLongFloatMap map = b.build(); map.put(1L, 10.1f); float v = map.get(1L); @@ -30,19 +30,20 @@ public void buildsBusyWaitingMap() { @Test public void buildsBlockingMap() { - var b = LongFloatMap.newBuilder() + var b = ConcurrentLongFloatMap.newBuilder() .withBuckets(2) .withDefaultValue(DEFAULT_VALUE) .withInitialCapacity(100) .withMode(PrimitiveMapBuilder.MapMode.BLOCKING) .withLoadFactor(0.8f); - LongFloatMap map = b.build(); + ConcurrentLongFloatMap map = b.build(); map.put(1L, 10.1f); float v = map.get(1L); assertInstanceOf(ConcurrentLongFloatMap.class, map); + assertSame(ConcurrentLongFloatMap.class, map.getClass()); assertEquals(10.1f, v); assertEquals(map.get(2L), map.getDefaultValue()); } From 9c460f01af0e5ba70cc42ed0ae250492149592c3 Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 17:51:22 +0300 Subject: [PATCH 06/17] more understandable package structure --- .../com/trivago/kangaroo/AbstractBenchHelper.java | 2 +- .../{map => }/PrimitiveConcurrentMap.java | 11 ++++++----- .../ConcurrentBusyWaitingIntFloatMap.java | 2 +- .../ConcurrentBusyWaitingIntIntMap.java | 2 +- .../{map => intkey}/ConcurrentIntFloatMap.java | 3 ++- .../{map => intkey}/ConcurrentIntIntMap.java | 3 ++- .../ConcurrentBusyWaitingLongFloatMap.java | 2 +- .../ConcurrentBusyWaitingLongIntMap.java | 2 +- .../ConcurrentBusyWaitingLongLongMap.java | 2 +- .../{map => longkey}/ConcurrentLongFloatMap.java | 3 ++- .../{map => longkey}/ConcurrentLongIntMap.java | 3 ++- .../{map => longkey}/ConcurrentLongLongMap.java | 3 ++- .../ConcurrentIntFloatMapBuilderTest.java | 4 ++-- .../ConcurrentIntIntMapBuilderTest.java | 4 ++-- .../ConcurrentLongFloatMapBuilderTest.java | 4 ++-- .../ConcurrentLongIntMapBuilderTest.java | 4 ++-- .../ConcurrentLongLongMapBuilderTest.java | 4 ++-- .../ConcurrentBusyWaitingIntFloatMapTest.java | 2 +- .../{map => intkey}/PrimitiveConcurrentMapTest.java | 3 ++- .../longint/AbstractLongIntMapTest.java | 2 +- .../longint/ConcurrentBusyWaitingLongIntMapTest.java | 2 +- .../longint/ConcurrentPrimitiveLongIntMapTest.java | 2 +- .../longint/PrimitiveFastutilLongIntWrapperTest.java | 2 +- .../longlong/AbstractLongLongMapTest.java | 2 +- .../ConcurrentBusyWaitingLongLongMapTest.java | 2 +- .../longlong/ConcurrentLongLongMapTest.java | 2 +- .../PrimitiveFastutilLongLongWrapperTest.java | 2 +- 27 files changed, 43 insertions(+), 36 deletions(-) rename src/main/java/com/trivago/fastutilconcurrentwrapper/{map => }/PrimitiveConcurrentMap.java (86%) rename src/main/java/com/trivago/fastutilconcurrentwrapper/{map => intkey}/ConcurrentBusyWaitingIntFloatMap.java (98%) rename src/main/java/com/trivago/fastutilconcurrentwrapper/{map => intkey}/ConcurrentBusyWaitingIntIntMap.java (98%) rename src/main/java/com/trivago/fastutilconcurrentwrapper/{map => intkey}/ConcurrentIntFloatMap.java (96%) rename src/main/java/com/trivago/fastutilconcurrentwrapper/{map => intkey}/ConcurrentIntIntMap.java (96%) rename src/main/java/com/trivago/fastutilconcurrentwrapper/{map => longkey}/ConcurrentBusyWaitingLongFloatMap.java (98%) rename src/main/java/com/trivago/fastutilconcurrentwrapper/{map => longkey}/ConcurrentBusyWaitingLongIntMap.java (98%) rename src/main/java/com/trivago/fastutilconcurrentwrapper/{map => longkey}/ConcurrentBusyWaitingLongLongMap.java (98%) rename src/main/java/com/trivago/fastutilconcurrentwrapper/{map => longkey}/ConcurrentLongFloatMap.java (96%) rename src/main/java/com/trivago/fastutilconcurrentwrapper/{map => longkey}/ConcurrentLongIntMap.java (96%) rename src/main/java/com/trivago/fastutilconcurrentwrapper/{map => longkey}/ConcurrentLongLongMap.java (96%) rename src/test/java/com/trivago/fastutilconcurrentwrapper/{map => intkey}/ConcurrentBusyWaitingIntFloatMapTest.java (94%) rename src/test/java/com/trivago/fastutilconcurrentwrapper/{map => intkey}/PrimitiveConcurrentMapTest.java (86%) diff --git a/src/jmh/java/com/trivago/kangaroo/AbstractBenchHelper.java b/src/jmh/java/com/trivago/kangaroo/AbstractBenchHelper.java index 5d6ceb6..cff591e 100644 --- a/src/jmh/java/com/trivago/kangaroo/AbstractBenchHelper.java +++ b/src/jmh/java/com/trivago/kangaroo/AbstractBenchHelper.java @@ -1,7 +1,7 @@ package com.trivago.kangaroo; import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongLongMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentLongLongMap; import java.util.concurrent.ThreadLocalRandom; diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/PrimitiveConcurrentMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/PrimitiveConcurrentMap.java similarity index 86% rename from src/main/java/com/trivago/fastutilconcurrentwrapper/map/PrimitiveConcurrentMap.java rename to src/main/java/com/trivago/fastutilconcurrentwrapper/PrimitiveConcurrentMap.java index 266b349..8d75145 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/PrimitiveConcurrentMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/PrimitiveConcurrentMap.java @@ -1,6 +1,5 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper; -import com.trivago.fastutilconcurrentwrapper.PrimitiveKeyMap; import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.HashCommon; @@ -16,12 +15,14 @@ public abstract class PrimitiveConcurrentMap implements PrimitiveKeyMap { protected final int numBuckets; protected final ReadWriteLock[] locks; - protected PrimitiveConcurrentMap(int numBuckets) { + protected PrimitiveConcurrentMap (int numBuckets) { + if (numBuckets < 1 || numBuckets > 100_000_000) + throw new IllegalArgumentException("numBuckets must be between 1 and 100_000_000, but: "+ numBuckets); this.numBuckets = numBuckets; this.locks = new ReadWriteLock[numBuckets]; for (int i = 0; i < numBuckets; i++) locks[i] = new ReentrantReadWriteLock(); - } + }//new /** Lock must be held! */ protected abstract Function mapAt (int index); @@ -79,7 +80,7 @@ protected int getBucket(int key) { return bucket(key, numBuckets);// Integer.hashCode(key) == key } - static int bucket (int hash, int bucketSize) { + public static int bucket (int hash, int bucketSize) { return Math.abs(HashCommon.mix(hash) % bucketSize); } } \ No newline at end of file diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentBusyWaitingIntFloatMap.java similarity index 98% rename from src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMap.java rename to src/main/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentBusyWaitingIntFloatMap.java index 5f0238d..e94aec3 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentBusyWaitingIntFloatMap.java @@ -1,4 +1,4 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper.intkey; import it.unimi.dsi.fastutil.ints.Int2FloatFunction; diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntIntMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentBusyWaitingIntIntMap.java similarity index 98% rename from src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntIntMap.java rename to src/main/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentBusyWaitingIntIntMap.java index 3a9e378..0e22bb2 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntIntMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentBusyWaitingIntIntMap.java @@ -1,4 +1,4 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper.intkey; import it.unimi.dsi.fastutil.ints.Int2IntFunction; diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntFloatMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentIntFloatMap.java similarity index 96% rename from src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntFloatMap.java rename to src/main/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentIntFloatMap.java index 7dcad69..8cf7244 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntFloatMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentIntFloatMap.java @@ -1,5 +1,6 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper.intkey; +import com.trivago.fastutilconcurrentwrapper.PrimitiveConcurrentMap; import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.ints.Int2FloatFunction; diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntIntMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentIntIntMap.java similarity index 96% rename from src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntIntMap.java rename to src/main/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentIntIntMap.java index 7c8c158..f738b7e 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentIntIntMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentIntIntMap.java @@ -1,5 +1,6 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper.intkey; +import com.trivago.fastutilconcurrentwrapper.PrimitiveConcurrentMap; import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.ints.Int2IntFunction; diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongFloatMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongFloatMap.java similarity index 98% rename from src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongFloatMap.java rename to src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongFloatMap.java index a1a8582..9e18a06 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongFloatMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongFloatMap.java @@ -1,4 +1,4 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper.longkey; import it.unimi.dsi.fastutil.longs.Long2FloatFunction; diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongIntMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongIntMap.java similarity index 98% rename from src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongIntMap.java rename to src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongIntMap.java index 181d09b..a08057d 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongIntMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongIntMap.java @@ -1,4 +1,4 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper.longkey; import it.unimi.dsi.fastutil.longs.Long2IntFunction; diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongLongMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongLongMap.java similarity index 98% rename from src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongLongMap.java rename to src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongLongMap.java index 0963e74..80917cd 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingLongLongMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongLongMap.java @@ -1,4 +1,4 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper.longkey; import it.unimi.dsi.fastutil.longs.Long2LongFunction; diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongFloatMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongFloatMap.java similarity index 96% rename from src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongFloatMap.java rename to src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongFloatMap.java index 703af88..8809d30 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongFloatMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongFloatMap.java @@ -1,5 +1,6 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper.longkey; +import com.trivago.fastutilconcurrentwrapper.PrimitiveConcurrentMap; import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.longs.Long2FloatFunction; diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongIntMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongIntMap.java similarity index 96% rename from src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongIntMap.java rename to src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongIntMap.java index 4289bfa..31ec48b 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongIntMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongIntMap.java @@ -1,5 +1,6 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper.longkey; +import com.trivago.fastutilconcurrentwrapper.PrimitiveConcurrentMap; import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.longs.Long2IntFunction; diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongLongMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongLongMap.java similarity index 96% rename from src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongLongMap.java rename to src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongLongMap.java index d08a15b..afbfd9d 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentLongLongMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongLongMap.java @@ -1,5 +1,6 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper.longkey; +import com.trivago.fastutilconcurrentwrapper.PrimitiveConcurrentMap; import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; import it.unimi.dsi.fastutil.Function; import it.unimi.dsi.fastutil.longs.Long2LongFunction; diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntFloatMapBuilderTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntFloatMapBuilderTest.java index 93f08ee..fabb218 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntFloatMapBuilderTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntFloatMapBuilderTest.java @@ -1,7 +1,7 @@ package com.trivago.fastutilconcurrentwrapper; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingIntFloatMap; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentIntFloatMap; +import com.trivago.fastutilconcurrentwrapper.intkey.ConcurrentBusyWaitingIntFloatMap; +import com.trivago.fastutilconcurrentwrapper.intkey.ConcurrentIntFloatMap; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntIntMapBuilderTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntIntMapBuilderTest.java index 9088f15..d095aeb 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntIntMapBuilderTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentIntIntMapBuilderTest.java @@ -1,7 +1,7 @@ package com.trivago.fastutilconcurrentwrapper; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingIntIntMap; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentIntIntMap; +import com.trivago.fastutilconcurrentwrapper.intkey.ConcurrentBusyWaitingIntIntMap; +import com.trivago.fastutilconcurrentwrapper.intkey.ConcurrentIntIntMap; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongFloatMapBuilderTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongFloatMapBuilderTest.java index 3992818..77cfab4 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongFloatMapBuilderTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongFloatMapBuilderTest.java @@ -1,7 +1,7 @@ package com.trivago.fastutilconcurrentwrapper; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingLongFloatMap; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongFloatMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentBusyWaitingLongFloatMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentLongFloatMap; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongIntMapBuilderTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongIntMapBuilderTest.java index c4a7279..88cdbdf 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongIntMapBuilderTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongIntMapBuilderTest.java @@ -1,7 +1,7 @@ package com.trivago.fastutilconcurrentwrapper; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingLongIntMap; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongIntMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentBusyWaitingLongIntMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentLongIntMap; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongLongMapBuilderTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongLongMapBuilderTest.java index ed63a71..aa50e80 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongLongMapBuilderTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/ConcurrentLongLongMapBuilderTest.java @@ -1,7 +1,7 @@ package com.trivago.fastutilconcurrentwrapper; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingLongLongMap; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongLongMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentBusyWaitingLongLongMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentLongLongMap; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentBusyWaitingIntFloatMapTest.java similarity index 94% rename from src/test/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMapTest.java rename to src/test/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentBusyWaitingIntFloatMapTest.java index 6609f59..c9e25a6 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/map/ConcurrentBusyWaitingIntFloatMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/intkey/ConcurrentBusyWaitingIntFloatMapTest.java @@ -1,4 +1,4 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper.intkey; import org.junit.jupiter.api.Test; diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/map/PrimitiveConcurrentMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/intkey/PrimitiveConcurrentMapTest.java similarity index 86% rename from src/test/java/com/trivago/fastutilconcurrentwrapper/map/PrimitiveConcurrentMapTest.java rename to src/test/java/com/trivago/fastutilconcurrentwrapper/intkey/PrimitiveConcurrentMapTest.java index 70aa0e4..4d57b1c 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/map/PrimitiveConcurrentMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/intkey/PrimitiveConcurrentMapTest.java @@ -1,5 +1,6 @@ -package com.trivago.fastutilconcurrentwrapper.map; +package com.trivago.fastutilconcurrentwrapper.intkey; +import com.trivago.fastutilconcurrentwrapper.PrimitiveConcurrentMap; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/AbstractLongIntMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/AbstractLongIntMapTest.java index fa6300e..8c4c8ac 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/AbstractLongIntMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/AbstractLongIntMapTest.java @@ -1,7 +1,7 @@ package com.trivago.fastutilconcurrentwrapper.longint; import com.trivago.fastutilconcurrentwrapper.AbstractMapTest; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongIntMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentLongIntMap; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentBusyWaitingLongIntMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentBusyWaitingLongIntMapTest.java index 8e41356..05161af 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentBusyWaitingLongIntMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentBusyWaitingLongIntMapTest.java @@ -1,6 +1,6 @@ package com.trivago.fastutilconcurrentwrapper.longint; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingLongIntMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentBusyWaitingLongIntMap; public class ConcurrentBusyWaitingLongIntMapTest extends AbstractLongIntMapTest { @Override diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentPrimitiveLongIntMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentPrimitiveLongIntMapTest.java index 0c7feee..73a3135 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentPrimitiveLongIntMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/ConcurrentPrimitiveLongIntMapTest.java @@ -1,6 +1,6 @@ package com.trivago.fastutilconcurrentwrapper.longint; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongIntMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentLongIntMap; public class ConcurrentPrimitiveLongIntMapTest extends AbstractLongIntMapTest { diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/PrimitiveFastutilLongIntWrapperTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/PrimitiveFastutilLongIntWrapperTest.java index fe27ff4..58c9b12 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/PrimitiveFastutilLongIntWrapperTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longint/PrimitiveFastutilLongIntWrapperTest.java @@ -1,6 +1,6 @@ package com.trivago.fastutilconcurrentwrapper.longint; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongIntMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentLongIntMap; public class PrimitiveFastutilLongIntWrapperTest extends AbstractLongIntMapTest { @Override diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/AbstractLongLongMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/AbstractLongLongMapTest.java index 217a4b1..3ec2ff0 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/AbstractLongLongMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/AbstractLongLongMapTest.java @@ -1,7 +1,7 @@ package com.trivago.fastutilconcurrentwrapper.longlong; import com.trivago.fastutilconcurrentwrapper.AbstractMapTest; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongLongMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentLongLongMap; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentBusyWaitingLongLongMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentBusyWaitingLongLongMapTest.java index 0f51fec..038cde0 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentBusyWaitingLongLongMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentBusyWaitingLongLongMapTest.java @@ -1,6 +1,6 @@ package com.trivago.fastutilconcurrentwrapper.longlong; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentBusyWaitingLongLongMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentBusyWaitingLongLongMap; public class ConcurrentBusyWaitingLongLongMapTest extends AbstractLongLongMapTest { diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentLongLongMapTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentLongLongMapTest.java index 2b1b2fd..3e0559b 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentLongLongMapTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/ConcurrentLongLongMapTest.java @@ -1,6 +1,6 @@ package com.trivago.fastutilconcurrentwrapper.longlong; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongLongMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentLongLongMap; public class ConcurrentLongLongMapTest extends AbstractLongLongMapTest { diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/PrimitiveFastutilLongLongWrapperTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/PrimitiveFastutilLongLongWrapperTest.java index 1e63bdd..b4efeb9 100644 --- a/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/PrimitiveFastutilLongLongWrapperTest.java +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/longlong/PrimitiveFastutilLongLongWrapperTest.java @@ -1,6 +1,6 @@ package com.trivago.fastutilconcurrentwrapper.longlong; -import com.trivago.fastutilconcurrentwrapper.map.ConcurrentLongLongMap; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentLongLongMap; public class PrimitiveFastutilLongLongWrapperTest extends AbstractLongLongMapTest { @Override From eebb7f80d55859eb5909cfed8fdba396fbdc8f5c Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 18:14:14 +0300 Subject: [PATCH 07/17] see also JCTools' org.jctools.maps.NonBlockingHashMapLong --- .../fastutilconcurrentwrapper/PrimitiveConcurrentMap.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/PrimitiveConcurrentMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/PrimitiveConcurrentMap.java index 8d75145..54b9728 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/PrimitiveConcurrentMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/PrimitiveConcurrentMap.java @@ -10,6 +10,7 @@ /** @see it.unimi.dsi.fastutil.Function @see com.google.common.util.concurrent.Striped + @see org.jctools.maps.NonBlockingHashMapLong */ public abstract class PrimitiveConcurrentMap implements PrimitiveKeyMap { protected final int numBuckets; From 227be19a5bf97f4ccb24e368acb04192dd00fa3c Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 18:26:33 +0300 Subject: [PATCH 08/17] + ConcurrentLongObjectMap/ConcurrentBusyWaitingLongObjectMap --- .../ConcurrentBusyWaitingLongObjectMap.java | 138 ++++++++++++++++++ .../longkey/ConcurrentLongObjectMap.java | 132 +++++++++++++++++ 2 files changed, 270 insertions(+) create mode 100644 src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongObjectMap.java create mode 100644 src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongObjectMap.java diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongObjectMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongObjectMap.java new file mode 100644 index 0000000..76e2352 --- /dev/null +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentBusyWaitingLongObjectMap.java @@ -0,0 +1,138 @@ +package com.trivago.fastutilconcurrentwrapper.longkey; + +import it.unimi.dsi.fastutil.longs.Long2ObjectFunction; + +import java.util.concurrent.locks.Lock; +import java.util.function.BiFunction; + +public class ConcurrentBusyWaitingLongObjectMap extends ConcurrentLongObjectMap { + public ConcurrentBusyWaitingLongObjectMap (int numBuckets, int initialCapacity, float loadFactor, V defaultValue) { + super(numBuckets, initialCapacity, loadFactor, defaultValue); + } + + @Override + public boolean containsKey(long key) { + int bucket = getBucket(key); + + Lock readLock = locks[bucket].readLock(); + + while (true) { + if (readLock.tryLock()) { + try { + return maps[bucket].containsKey(key); + } finally { + readLock.unlock(); + } + } + Thread.onSpinWait(); + } + } + + @Override + public V get (long key) { + int bucket = getBucket(key); + + Lock readLock = locks[bucket].readLock(); + + while (true) { + if (readLock.tryLock()) { + try { + return maps[bucket].getOrDefault(key, defaultValue); + } finally { + readLock.unlock(); + } + } + Thread.onSpinWait(); + } + } + + @Override + public V put (long key, V value) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + + while (true) { + if (writeLock.tryLock()) { + try { + return maps[bucket].put(key, value); + } finally { + writeLock.unlock(); + } + } + Thread.onSpinWait(); + } + } + + @Override + public V remove (long key) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + + while (true) { + if (writeLock.tryLock()) { + try { + return maps[bucket].remove(key); + } finally { + writeLock.unlock(); + } + } + Thread.onSpinWait(); + } + } + + @Override + public boolean remove (long key, V value) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + + while (true) { + if (writeLock.tryLock()) { + try { + return maps[bucket].remove(key, value); + } finally { + writeLock.unlock(); + } + } + Thread.onSpinWait(); + } + } + + @Override + public V computeIfAbsent (long key, Long2ObjectFunction mappingFunction) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + + while (true) { + if (writeLock.tryLock()) { + try { + return maps[bucket].computeIfAbsent(key, mappingFunction); + } finally { + writeLock.unlock(); + } + } + Thread.onSpinWait(); + } + } + + @Override + public V computeIfPresent (long key, BiFunction mappingFunction) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + + while (true) { + if (writeLock.tryLock()) { + try { + return maps[bucket].computeIfPresent(key, mappingFunction); + } finally { + writeLock.unlock(); + } + } + Thread.onSpinWait(); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongObjectMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongObjectMap.java new file mode 100644 index 0000000..ade418d --- /dev/null +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongObjectMap.java @@ -0,0 +1,132 @@ +package com.trivago.fastutilconcurrentwrapper.longkey; + +import com.trivago.fastutilconcurrentwrapper.PrimitiveConcurrentMap; +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; +import it.unimi.dsi.fastutil.Function; +import it.unimi.dsi.fastutil.longs.Long2ObjectFunction; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; + +import java.util.concurrent.locks.Lock; +import java.util.function.BiFunction; + +public class ConcurrentLongObjectMap extends PrimitiveConcurrentMap { + protected final Long2ObjectOpenHashMap[] maps; + protected final V defaultValue; + + @SuppressWarnings("unchecked") + public ConcurrentLongObjectMap ( + int numBuckets, + int initialCapacity, + float loadFactor, + V defaultValue + ){ + super(numBuckets); + this.maps = new Long2ObjectOpenHashMap[numBuckets]; + this.defaultValue = defaultValue; + for (int i = 0; i < numBuckets; i++) + maps[i] = new Long2ObjectOpenHashMap<>(initialCapacity, loadFactor); + } + + @Override + protected final Function mapAt (int index) { + return maps[index]; + } + + public boolean containsKey(long key) { + int bucket = getBucket(key); + + Lock readLock = locks[bucket].readLock(); + readLock.lock(); + try { + return maps[bucket].containsKey(key); + } finally { + readLock.unlock(); + } + } + + public V get (long key) { + int bucket = getBucket(key); + + Lock readLock = locks[bucket].readLock(); + readLock.lock(); + try { + return maps[bucket].getOrDefault(key, defaultValue); + } finally { + readLock.unlock(); + } + } + + public V put (long key, V value) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + writeLock.lock(); + try { + return maps[bucket].put(key, value); + } finally { + writeLock.unlock(); + } + } + + public V getDefaultValue (){ return defaultValue; } + + public V remove (long key) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + writeLock.lock(); + try { + return maps[bucket].remove(key); + } finally { + writeLock.unlock(); + } + } + + public boolean remove(long key, V value) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + writeLock.lock(); + try { + return maps[bucket].remove(key, value); + } finally { + writeLock.unlock(); + } + } + + public V computeIfAbsent (long key, Long2ObjectFunction mappingFunction) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + writeLock.lock(); + try { + return maps[bucket].computeIfAbsent(key, mappingFunction); + } finally { + writeLock.unlock(); + } + } + + public V computeIfPresent (long key, BiFunction mappingFunction) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + writeLock.lock(); + try { + return maps[bucket].computeIfPresent(key, mappingFunction); + } finally { + writeLock.unlock(); + } + } + + public static PrimitiveMapBuilder,V> newBuilder () { + return new PrimitiveMapBuilder<>(){ + @Override + public ConcurrentLongObjectMap build() { + return switch (mapMode){ + case BUSY_WAITING -> new ConcurrentBusyWaitingLongObjectMap(buckets, initialCapacity, loadFactor, super.defaultValue); + case BLOCKING -> new ConcurrentLongObjectMap(buckets, initialCapacity, loadFactor, super.defaultValue); + }; + } + }; + } +} \ No newline at end of file From 9efc297951c9a4f879c55333bf72df2401d74f8b Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 18:42:47 +0300 Subject: [PATCH 09/17] fix generic; ConcurrentObjectLongMap/ConcurrentBusyWaitingObjectLongMap --- .../PrimitiveConcurrentMap.java | 4 + .../longkey/ConcurrentLongObjectMap.java | 4 +- .../ConcurrentBusyWaitingObjectLongMap.java | 138 ++++++++++++++++++ .../objkey/ConcurrentObjectLongMap.java | 132 +++++++++++++++++ 4 files changed, 276 insertions(+), 2 deletions(-) create mode 100644 src/main/java/com/trivago/fastutilconcurrentwrapper/objkey/ConcurrentBusyWaitingObjectLongMap.java create mode 100644 src/main/java/com/trivago/fastutilconcurrentwrapper/objkey/ConcurrentObjectLongMap.java diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/PrimitiveConcurrentMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/PrimitiveConcurrentMap.java index 54b9728..5ce9579 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/PrimitiveConcurrentMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/PrimitiveConcurrentMap.java @@ -81,6 +81,10 @@ protected int getBucket(int key) { return bucket(key, numBuckets);// Integer.hashCode(key) == key } + protected int getBucket (Object key) { + return key != null ? bucket(key.hashCode(), numBuckets) : 0; + } + public static int bucket (int hash, int bucketSize) { return Math.abs(HashCommon.mix(hash) % bucketSize); } diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongObjectMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongObjectMap.java index ade418d..9f5180a 100644 --- a/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongObjectMap.java +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/longkey/ConcurrentLongObjectMap.java @@ -123,8 +123,8 @@ public static PrimitiveMapBuilder,V> newBuilder ( @Override public ConcurrentLongObjectMap build() { return switch (mapMode){ - case BUSY_WAITING -> new ConcurrentBusyWaitingLongObjectMap(buckets, initialCapacity, loadFactor, super.defaultValue); - case BLOCKING -> new ConcurrentLongObjectMap(buckets, initialCapacity, loadFactor, super.defaultValue); + case BUSY_WAITING -> new ConcurrentBusyWaitingLongObjectMap<>(buckets, initialCapacity, loadFactor, super.defaultValue); + case BLOCKING -> new ConcurrentLongObjectMap<>(buckets, initialCapacity, loadFactor, super.defaultValue); }; } }; diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/objkey/ConcurrentBusyWaitingObjectLongMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/objkey/ConcurrentBusyWaitingObjectLongMap.java new file mode 100644 index 0000000..7813157 --- /dev/null +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/objkey/ConcurrentBusyWaitingObjectLongMap.java @@ -0,0 +1,138 @@ +package com.trivago.fastutilconcurrentwrapper.objkey; + +import it.unimi.dsi.fastutil.objects.Object2LongFunction; + +import java.util.concurrent.locks.Lock; +import java.util.function.BiFunction; + +public class ConcurrentBusyWaitingObjectLongMap extends ConcurrentObjectLongMap { + public ConcurrentBusyWaitingObjectLongMap (int numBuckets, int initialCapacity, float loadFactor, long defaultValue) { + super(numBuckets, initialCapacity, loadFactor, defaultValue); + } + + @Override + public boolean containsKey (K key) { + int bucket = getBucket(key); + + Lock readLock = locks[bucket].readLock(); + + while (true) { + if (readLock.tryLock()) { + try { + return maps[bucket].containsKey(key); + } finally { + readLock.unlock(); + } + } + Thread.onSpinWait(); + } + } + + @Override + public long get (K key) { + int bucket = getBucket(key); + + Lock readLock = locks[bucket].readLock(); + + while (true) { + if (readLock.tryLock()) { + try { + return maps[bucket].getOrDefault(key, defaultValue); + } finally { + readLock.unlock(); + } + } + Thread.onSpinWait(); + } + } + + @Override + public long put (K key, long value) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + + while (true) { + if (writeLock.tryLock()) { + try { + return maps[bucket].put(key, value); + } finally { + writeLock.unlock(); + } + } + Thread.onSpinWait(); + } + } + + @Override + public long remove (K key) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + + while (true) { + if (writeLock.tryLock()) { + try { + return maps[bucket].removeLong(key); + } finally { + writeLock.unlock(); + } + } + Thread.onSpinWait(); + } + } + + @Override + public boolean remove (K key, long value) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + + while (true) { + if (writeLock.tryLock()) { + try { + return maps[bucket].remove(key, value); + } finally { + writeLock.unlock(); + } + } + Thread.onSpinWait(); + } + } + + @Override + public long computeIfAbsent (K key, Object2LongFunction mappingFunction) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + + while (true) { + if (writeLock.tryLock()) { + try { + return maps[bucket].computeIfAbsent(key, mappingFunction); + } finally { + writeLock.unlock(); + } + } + Thread.onSpinWait(); + } + } + + @Override + public long computeIfPresent (K key, BiFunction mappingFunction) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + + while (true) { + if (writeLock.tryLock()) { + try { + return maps[bucket].computeIfPresent(key, mappingFunction); + } finally { + writeLock.unlock(); + } + } + Thread.onSpinWait(); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/trivago/fastutilconcurrentwrapper/objkey/ConcurrentObjectLongMap.java b/src/main/java/com/trivago/fastutilconcurrentwrapper/objkey/ConcurrentObjectLongMap.java new file mode 100644 index 0000000..f20120e --- /dev/null +++ b/src/main/java/com/trivago/fastutilconcurrentwrapper/objkey/ConcurrentObjectLongMap.java @@ -0,0 +1,132 @@ +package com.trivago.fastutilconcurrentwrapper.objkey; + +import com.trivago.fastutilconcurrentwrapper.PrimitiveConcurrentMap; +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; +import it.unimi.dsi.fastutil.Function; +import it.unimi.dsi.fastutil.objects.Object2LongFunction; +import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; + +import java.util.concurrent.locks.Lock; +import java.util.function.BiFunction; + +public class ConcurrentObjectLongMap extends PrimitiveConcurrentMap { + protected final Object2LongOpenHashMap[] maps; + protected final long defaultValue; + + @SuppressWarnings("unchecked") + public ConcurrentObjectLongMap ( + int numBuckets, + int initialCapacity, + float loadFactor, + long defaultValue + ){ + super(numBuckets); + this.maps = new Object2LongOpenHashMap[numBuckets]; + this.defaultValue = defaultValue; + for (int i = 0; i < numBuckets; i++) + maps[i] = new Object2LongOpenHashMap<>(initialCapacity, loadFactor); + } + + @Override + protected final Function mapAt (int index) { + return maps[index]; + } + + public boolean containsKey(K key) { + int bucket = getBucket(key); + + Lock readLock = locks[bucket].readLock(); + readLock.lock(); + try { + return maps[bucket].containsKey(key); + } finally { + readLock.unlock(); + } + } + + public long get (K key) { + int bucket = getBucket(key); + + Lock readLock = locks[bucket].readLock(); + readLock.lock(); + try { + return maps[bucket].getOrDefault(key, defaultValue); + } finally { + readLock.unlock(); + } + } + + public long put (K key, long value) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + writeLock.lock(); + try { + return maps[bucket].put(key, value); + } finally { + writeLock.unlock(); + } + } + + public long getDefaultValue (){ return defaultValue; } + + public long remove (K key) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + writeLock.lock(); + try { + return maps[bucket].removeLong(key); + } finally { + writeLock.unlock(); + } + } + + public boolean remove (K key, long value) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + writeLock.lock(); + try { + return maps[bucket].remove(key, value); + } finally { + writeLock.unlock(); + } + } + + public long computeIfAbsent (K key, Object2LongFunction mappingFunction) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + writeLock.lock(); + try { + return maps[bucket].computeIfAbsent(key, mappingFunction); + } finally { + writeLock.unlock(); + } + } + + public long computeIfPresent (K key, BiFunction mappingFunction) { + int bucket = getBucket(key); + + Lock writeLock = locks[bucket].writeLock(); + writeLock.lock(); + try { + return maps[bucket].computeIfPresent(key, mappingFunction); + } finally { + writeLock.unlock(); + } + } + + public static PrimitiveMapBuilder,Long> newBuilder () { + return new PrimitiveMapBuilder<>(){ + @Override + public ConcurrentObjectLongMap build() { + return switch (mapMode){ + case BUSY_WAITING -> new ConcurrentBusyWaitingObjectLongMap<>(buckets, initialCapacity, loadFactor, super.defaultValue); + case BLOCKING -> new ConcurrentObjectLongMap<>(buckets, initialCapacity, loadFactor, super.defaultValue); + }; + } + }; + } +} \ No newline at end of file From 5f27ce69bc0f99bfc67fb40577c58b8139c2baa2 Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 18:51:35 +0300 Subject: [PATCH 10/17] jmh tests from https://github.com/FxMorin/fastutil-concurrent-wrapper/tree/feature/object-keys --- .../kangaroo/JavaUtilWrapperBenchmark.java | 11 ++-- .../AbstractLongLongBenchHelper.java | 58 +++++++++++++++++ ...ilWrapperBusyWaitingLongLongBenchmark.java | 19 ++++++ ...stutilWrapperDefaultLongLongBenchmark.java | 19 ++++++ .../JavaConcurrentLongLongBenchmark.java | 62 ++++++++++++++++++ .../JavaUtilWrapperLongLongBenchmark.java | 64 +++++++++++++++++++ .../AbstractObjectLongBenchHelper.java | 58 +++++++++++++++++ ...WrapperBusyWaitingObjectLongBenchmark.java | 19 ++++++ ...utilWrapperDefaultObjectLongBenchmark.java | 19 ++++++ .../JavaConcurrentObjectLongBenchmark.java | 61 ++++++++++++++++++ .../JavaUtilWrapperObjectLongBenchmark.java | 63 ++++++++++++++++++ .../kangaroo/object2long/TestObjectKey.java | 13 ++++ 12 files changed, 462 insertions(+), 4 deletions(-) create mode 100644 src/jmh/java/com/trivago/kangaroo/long2long/AbstractLongLongBenchHelper.java create mode 100644 src/jmh/java/com/trivago/kangaroo/long2long/FastutilWrapperBusyWaitingLongLongBenchmark.java create mode 100644 src/jmh/java/com/trivago/kangaroo/long2long/FastutilWrapperDefaultLongLongBenchmark.java create mode 100644 src/jmh/java/com/trivago/kangaroo/long2long/JavaConcurrentLongLongBenchmark.java create mode 100644 src/jmh/java/com/trivago/kangaroo/long2long/JavaUtilWrapperLongLongBenchmark.java create mode 100644 src/jmh/java/com/trivago/kangaroo/object2long/AbstractObjectLongBenchHelper.java create mode 100644 src/jmh/java/com/trivago/kangaroo/object2long/FastutilWrapperBusyWaitingObjectLongBenchmark.java create mode 100644 src/jmh/java/com/trivago/kangaroo/object2long/FastutilWrapperDefaultObjectLongBenchmark.java create mode 100644 src/jmh/java/com/trivago/kangaroo/object2long/JavaConcurrentObjectLongBenchmark.java create mode 100644 src/jmh/java/com/trivago/kangaroo/object2long/JavaUtilWrapperObjectLongBenchmark.java create mode 100644 src/jmh/java/com/trivago/kangaroo/object2long/TestObjectKey.java diff --git a/src/jmh/java/com/trivago/kangaroo/JavaUtilWrapperBenchmark.java b/src/jmh/java/com/trivago/kangaroo/JavaUtilWrapperBenchmark.java index 695a6b8..8e3a997 100644 --- a/src/jmh/java/com/trivago/kangaroo/JavaUtilWrapperBenchmark.java +++ b/src/jmh/java/com/trivago/kangaroo/JavaUtilWrapperBenchmark.java @@ -30,18 +30,21 @@ public void loadData() { map = Collections.synchronizedMap(m); } - public void testGet() { + @Override + public void testGet() { long key = ThreadLocalRandom.current().nextLong(); map.get(key); } - public void testPut() { + @Override + public void testPut() { long key = ThreadLocalRandom.current().nextLong(); long value = ThreadLocalRandom.current().nextLong(); map.put(key, value); } - public void testAllOps() { + @Override + public void testAllOps() { int op = ThreadLocalRandom.current().nextInt(3); long key = ThreadLocalRandom.current().nextLong(); switch (op) { @@ -57,4 +60,4 @@ public void testAllOps() { break; } } -} +} \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/long2long/AbstractLongLongBenchHelper.java b/src/jmh/java/com/trivago/kangaroo/long2long/AbstractLongLongBenchHelper.java new file mode 100644 index 0000000..cacaf5a --- /dev/null +++ b/src/jmh/java/com/trivago/kangaroo/long2long/AbstractLongLongBenchHelper.java @@ -0,0 +1,58 @@ +package com.trivago.kangaroo.long2long; + +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; +import com.trivago.fastutilconcurrentwrapper.longkey.ConcurrentLongLongMap; +import com.trivago.kangaroo.AbstractCommonBenchHelper; + +import java.util.concurrent.ThreadLocalRandom; + +public abstract class AbstractLongLongBenchHelper extends AbstractCommonBenchHelper { + protected static final int NUM_VALUES = 1_000_000; + protected ConcurrentLongLongMap map; + + public void initAndLoadData (PrimitiveMapBuilder.MapMode mode) { + map = ConcurrentLongLongMap.newBuilder() + .withBuckets(16) + .withInitialCapacity(NUM_VALUES) + .withMode(mode) + .withLoadFactor(0.8f) + .build(); + + for (int i = 0; i < NUM_VALUES; i++) { + long key = ThreadLocalRandom.current().nextLong(); + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + } + } + + @Override + public void testGet() { + long key = ThreadLocalRandom.current().nextLong(); + map.get(key); + } + + @Override + public void testPut() { + long key = ThreadLocalRandom.current().nextLong(); + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + } + + @Override + public void testAllOps() { + int op = ThreadLocalRandom.current().nextInt(3); + long key = ThreadLocalRandom.current().nextLong(); + switch (op) { + case 1: + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + break; + case 2: + map.remove(key); + break; + default: + map.get(key); + break; + } + } +} \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/long2long/FastutilWrapperBusyWaitingLongLongBenchmark.java b/src/jmh/java/com/trivago/kangaroo/long2long/FastutilWrapperBusyWaitingLongLongBenchmark.java new file mode 100644 index 0000000..e8733dc --- /dev/null +++ b/src/jmh/java/com/trivago/kangaroo/long2long/FastutilWrapperBusyWaitingLongLongBenchmark.java @@ -0,0 +1,19 @@ +package com.trivago.kangaroo.long2long; + +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; + +@State(Scope.Benchmark) +@Warmup(iterations = 3, time = 1) +@Measurement(iterations = 3, time = 2) +public class FastutilWrapperBusyWaitingLongLongBenchmark extends AbstractLongLongBenchHelper { + @Setup(Level.Trial) + public void loadData() { + initAndLoadData(PrimitiveMapBuilder.MapMode.BUSY_WAITING); + } +} \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/long2long/FastutilWrapperDefaultLongLongBenchmark.java b/src/jmh/java/com/trivago/kangaroo/long2long/FastutilWrapperDefaultLongLongBenchmark.java new file mode 100644 index 0000000..f20f5ca --- /dev/null +++ b/src/jmh/java/com/trivago/kangaroo/long2long/FastutilWrapperDefaultLongLongBenchmark.java @@ -0,0 +1,19 @@ +package com.trivago.kangaroo.long2long; + +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; + +@State(Scope.Benchmark) +@Warmup(iterations = 3, time = 1) +@Measurement(iterations = 3, time = 2) +public class FastutilWrapperDefaultLongLongBenchmark extends AbstractLongLongBenchHelper { + @Setup(Level.Trial) + public void loadData() { + initAndLoadData(PrimitiveMapBuilder.MapMode.BLOCKING); + } +} \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/long2long/JavaConcurrentLongLongBenchmark.java b/src/jmh/java/com/trivago/kangaroo/long2long/JavaConcurrentLongLongBenchmark.java new file mode 100644 index 0000000..16ca2e7 --- /dev/null +++ b/src/jmh/java/com/trivago/kangaroo/long2long/JavaConcurrentLongLongBenchmark.java @@ -0,0 +1,62 @@ +package com.trivago.kangaroo.long2long; + +import com.trivago.kangaroo.AbstractCommonBenchHelper; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ThreadLocalRandom; + +@State(Scope.Benchmark) +@Warmup(iterations = 3, time = 1) +@Measurement(iterations = 3, time = 2) +public class JavaConcurrentLongLongBenchmark extends AbstractCommonBenchHelper { + + Map map; + + @Setup(Level.Trial) + public void loadData() { + map = new ConcurrentHashMap<>(AbstractLongLongBenchHelper.NUM_VALUES, 0.8f); + for (int i = 0; i < AbstractLongLongBenchHelper.NUM_VALUES; i++) { + long key = ThreadLocalRandom.current().nextLong(); + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + } + } + + @Override + public void testGet() { + long key = ThreadLocalRandom.current().nextLong(); + map.get(key); + } + + @Override + public void testPut() { + long key = ThreadLocalRandom.current().nextLong(); + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + } + + @Override + public void testAllOps() { + int op = ThreadLocalRandom.current().nextInt(3); + long key = ThreadLocalRandom.current().nextLong(); + switch (op) { + case 1: + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + break; + case 2: + map.remove(key); + break; + default: + map.get(key); + break; + } + } +} \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/long2long/JavaUtilWrapperLongLongBenchmark.java b/src/jmh/java/com/trivago/kangaroo/long2long/JavaUtilWrapperLongLongBenchmark.java new file mode 100644 index 0000000..885466c --- /dev/null +++ b/src/jmh/java/com/trivago/kangaroo/long2long/JavaUtilWrapperLongLongBenchmark.java @@ -0,0 +1,64 @@ +package com.trivago.kangaroo.long2long; + +import com.trivago.kangaroo.AbstractCommonBenchHelper; +import it.unimi.dsi.fastutil.longs.Long2LongOpenHashMap; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; + +import java.util.Collections; +import java.util.Map; +import java.util.concurrent.ThreadLocalRandom; + +@State(Scope.Benchmark) +@Warmup(iterations = 3, time = 1) +@Measurement(iterations = 3, time = 2) +public class JavaUtilWrapperLongLongBenchmark extends AbstractCommonBenchHelper { + + Map map; + + @Setup(Level.Trial) + public void loadData() { + Long2LongOpenHashMap m = new Long2LongOpenHashMap(AbstractLongLongBenchHelper.NUM_VALUES, 0.8f); + for (int i = 0; i < AbstractLongLongBenchHelper.NUM_VALUES; i++) { + long key = ThreadLocalRandom.current().nextLong(); + long value = ThreadLocalRandom.current().nextLong(); + m.put(key, value); + } + map = Collections.synchronizedMap(m); + } + + @Override + public void testGet() { + long key = ThreadLocalRandom.current().nextLong(); + map.get(key); + } + + @Override + public void testPut() { + long key = ThreadLocalRandom.current().nextLong(); + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + } + + @Override + public void testAllOps() { + int op = ThreadLocalRandom.current().nextInt(3); + long key = ThreadLocalRandom.current().nextLong(); + switch (op) { + case 1: + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + break; + case 2: + map.remove(key); + break; + default: + map.get(key); + break; + } + } +} \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/object2long/AbstractObjectLongBenchHelper.java b/src/jmh/java/com/trivago/kangaroo/object2long/AbstractObjectLongBenchHelper.java new file mode 100644 index 0000000..ea02095 --- /dev/null +++ b/src/jmh/java/com/trivago/kangaroo/object2long/AbstractObjectLongBenchHelper.java @@ -0,0 +1,58 @@ +package com.trivago.kangaroo.object2long; + +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; +import com.trivago.fastutilconcurrentwrapper.objkey.ConcurrentObjectLongMap; +import com.trivago.kangaroo.AbstractCommonBenchHelper; + +import java.util.concurrent.ThreadLocalRandom; + +public abstract class AbstractObjectLongBenchHelper extends AbstractCommonBenchHelper { + protected static final int NUM_VALUES = 1_000_000; + protected ConcurrentObjectLongMap map; + + public void initAndLoadData (PrimitiveMapBuilder.MapMode mode) { + map = ConcurrentObjectLongMap.newBuilder() + .withBuckets(16) + .withInitialCapacity(NUM_VALUES) + .withMode(mode) + .withLoadFactor(0.8f) + .build(); + + for (int i = 0; i < NUM_VALUES; i++) { + TestObjectKey key = new TestObjectKey(); + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + } + } + + @Override + public void testGet() { + TestObjectKey key = new TestObjectKey(); + map.get(key); + } + + @Override + public void testPut() { + TestObjectKey key = new TestObjectKey(); + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + } + + @Override + public void testAllOps() { + int op = ThreadLocalRandom.current().nextInt(3); + TestObjectKey key = new TestObjectKey(); + switch (op) { + case 1: + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + break; + case 2: + map.remove(key); + break; + default: + map.get(key); + break; + } + } +} \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/object2long/FastutilWrapperBusyWaitingObjectLongBenchmark.java b/src/jmh/java/com/trivago/kangaroo/object2long/FastutilWrapperBusyWaitingObjectLongBenchmark.java new file mode 100644 index 0000000..47424c2 --- /dev/null +++ b/src/jmh/java/com/trivago/kangaroo/object2long/FastutilWrapperBusyWaitingObjectLongBenchmark.java @@ -0,0 +1,19 @@ +package com.trivago.kangaroo.object2long; + +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; + +@State(Scope.Benchmark) +@Warmup(iterations = 3, time = 1) +@Measurement(iterations = 3, time = 2) +public class FastutilWrapperBusyWaitingObjectLongBenchmark extends AbstractObjectLongBenchHelper { + @Setup(Level.Trial) + public void loadData() { + initAndLoadData(PrimitiveMapBuilder.MapMode.BUSY_WAITING); + } +} \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/object2long/FastutilWrapperDefaultObjectLongBenchmark.java b/src/jmh/java/com/trivago/kangaroo/object2long/FastutilWrapperDefaultObjectLongBenchmark.java new file mode 100644 index 0000000..cec4cce --- /dev/null +++ b/src/jmh/java/com/trivago/kangaroo/object2long/FastutilWrapperDefaultObjectLongBenchmark.java @@ -0,0 +1,19 @@ +package com.trivago.kangaroo.object2long; + +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; + +@State(Scope.Benchmark) +@Warmup(iterations = 3, time = 1) +@Measurement(iterations = 3, time = 2) +public class FastutilWrapperDefaultObjectLongBenchmark extends AbstractObjectLongBenchHelper { + @Setup(Level.Trial) + public void loadData() { + initAndLoadData(PrimitiveMapBuilder.MapMode.BLOCKING); + } +} \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/object2long/JavaConcurrentObjectLongBenchmark.java b/src/jmh/java/com/trivago/kangaroo/object2long/JavaConcurrentObjectLongBenchmark.java new file mode 100644 index 0000000..e790615 --- /dev/null +++ b/src/jmh/java/com/trivago/kangaroo/object2long/JavaConcurrentObjectLongBenchmark.java @@ -0,0 +1,61 @@ +package com.trivago.kangaroo.object2long; + +import com.trivago.kangaroo.AbstractCommonBenchHelper; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ThreadLocalRandom; + +@State(Scope.Benchmark) +@Warmup(iterations = 3, time = 1) +@Measurement(iterations = 3, time = 2) +public class JavaConcurrentObjectLongBenchmark extends AbstractCommonBenchHelper { + + Map map; + + @Setup(Level.Trial) + public void loadData() { + map = new ConcurrentHashMap<>(AbstractObjectLongBenchHelper.NUM_VALUES, 0.8f); + for (int i = 0; i < AbstractObjectLongBenchHelper.NUM_VALUES; i++) { + TestObjectKey key = new TestObjectKey(); + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + } + } + + @Override + public void testGet() { + map.get(new TestObjectKey()); + } + + @Override + public void testPut() { + TestObjectKey key = new TestObjectKey(); + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + } + + @Override + public void testAllOps() { + int op = ThreadLocalRandom.current().nextInt(3); + TestObjectKey key = new TestObjectKey(); + switch (op) { + case 1: + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + break; + case 2: + map.remove(key); + break; + default: + map.get(key); + break; + } + } +} \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/object2long/JavaUtilWrapperObjectLongBenchmark.java b/src/jmh/java/com/trivago/kangaroo/object2long/JavaUtilWrapperObjectLongBenchmark.java new file mode 100644 index 0000000..d794de2 --- /dev/null +++ b/src/jmh/java/com/trivago/kangaroo/object2long/JavaUtilWrapperObjectLongBenchmark.java @@ -0,0 +1,63 @@ +package com.trivago.kangaroo.object2long; + +import com.trivago.kangaroo.AbstractCommonBenchHelper; +import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; +import org.openjdk.jmh.annotations.Level; +import org.openjdk.jmh.annotations.Measurement; +import org.openjdk.jmh.annotations.Scope; +import org.openjdk.jmh.annotations.Setup; +import org.openjdk.jmh.annotations.State; +import org.openjdk.jmh.annotations.Warmup; + +import java.util.Collections; +import java.util.Map; +import java.util.concurrent.ThreadLocalRandom; + +@State(Scope.Benchmark) +@Warmup(iterations = 3, time = 1) +@Measurement(iterations = 3, time = 2) +public class JavaUtilWrapperObjectLongBenchmark extends AbstractCommonBenchHelper { + + Map map; + + @Setup(Level.Trial) + public void loadData() { + Object2LongOpenHashMap m = new Object2LongOpenHashMap<>(AbstractObjectLongBenchHelper.NUM_VALUES, 0.8f); + for (int i = 0; i < AbstractObjectLongBenchHelper.NUM_VALUES; i++) { + TestObjectKey key = new TestObjectKey(); + long value = ThreadLocalRandom.current().nextLong(); + m.put(key, value); + } + map = Collections.synchronizedMap(m); + } + + @Override + public void testGet() { + map.get(new TestObjectKey()); + } + + @Override + public void testPut() { + TestObjectKey key = new TestObjectKey(); + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + } + + @Override + public void testAllOps() { + int op = ThreadLocalRandom.current().nextInt(3); + TestObjectKey key = new TestObjectKey(); + switch (op) { + case 1: + long value = ThreadLocalRandom.current().nextLong(); + map.put(key, value); + break; + case 2: + map.remove(key); + break; + default: + map.get(key); + break; + } + } +} \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/object2long/TestObjectKey.java b/src/jmh/java/com/trivago/kangaroo/object2long/TestObjectKey.java new file mode 100644 index 0000000..2957802 --- /dev/null +++ b/src/jmh/java/com/trivago/kangaroo/object2long/TestObjectKey.java @@ -0,0 +1,13 @@ +package com.trivago.kangaroo.object2long; + +import java.util.concurrent.ThreadLocalRandom; + +public class TestObjectKey { + + private final int id = ThreadLocalRandom.current().nextInt(); + + @Override + public int hashCode() { + return Integer.hashCode(id); + } +} From 42bff7d05610f29bc2fb8a31a071a22265e1e9a9 Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 18:57:27 +0300 Subject: [PATCH 11/17] + ConcurrentObjectLongMapBuilderTest --- .../ConcurrentObjectLongMapBuilderTest.java | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/test/java/com/trivago/fastutilconcurrentwrapper/objkey/ConcurrentObjectLongMapBuilderTest.java diff --git a/src/test/java/com/trivago/fastutilconcurrentwrapper/objkey/ConcurrentObjectLongMapBuilderTest.java b/src/test/java/com/trivago/fastutilconcurrentwrapper/objkey/ConcurrentObjectLongMapBuilderTest.java new file mode 100644 index 0000000..0f1e8a7 --- /dev/null +++ b/src/test/java/com/trivago/fastutilconcurrentwrapper/objkey/ConcurrentObjectLongMapBuilderTest.java @@ -0,0 +1,48 @@ +package com.trivago.fastutilconcurrentwrapper.objkey; + +import com.trivago.fastutilconcurrentwrapper.PrimitiveMapBuilder; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +public class ConcurrentObjectLongMapBuilderTest { + private static final long DEFAULT_VALUE = -1L; + + @Test + public void simpleBuilderTest() { + var b = ConcurrentObjectLongMap.newBuilder() + .withBuckets(2) + .withDefaultValue(DEFAULT_VALUE) + .withInitialCapacity(100) + .withMode(PrimitiveMapBuilder.MapMode.BUSY_WAITING) + .withLoadFactor(0.9f); + + ConcurrentObjectLongMap map = b.build(); + + map.put((short) 17, 10L); + long v = map.get((short) 17); + + assertInstanceOf(ConcurrentBusyWaitingObjectLongMap.class, map); + assertEquals(10L, v); + assertEquals(map.get((short) 99), map.getDefaultValue()); + } + + @Test + public void buildsBlockingMap() { + var b = ConcurrentObjectLongMap.newBuilder() + .withBuckets(2) + .withDefaultValue(DEFAULT_VALUE) + .withInitialCapacity(100) + .withMode(PrimitiveMapBuilder.MapMode.BLOCKING) + .withLoadFactor(0.9f); + + ConcurrentObjectLongMap map = b.build(); + + map.put((short)41, 10L); + long v = map.get((short)41); + + assertInstanceOf(ConcurrentObjectLongMap.class, map); + assertEquals(10L, v); + assertEquals(map.get((short)47), map.getDefaultValue()); + } +} \ No newline at end of file From 0a20db70626c9bc64739a91933ad88750501ccd1 Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 19:11:08 +0300 Subject: [PATCH 12/17] =?UTF-8?q?jmh=20dislikes=20errorprone=20?= =?UTF-8?q?=F0=9F=A4=B7=E2=80=8D=E2=99=80=EF=B8=8F=20Help!=20=F0=9F=99=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 27 ++++++++++++++------------- settings.gradle | 9 ++++++++- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 67113fa..527ac78 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,9 @@ plugins { id "idea" id "java-library" - id "me.champeau.jmh" version "latest.release" +// id "net.ltgt.errorprone" version "latest.release" + id("me.champeau.jmh") version "latest.release" id "com.vanniktech.maven.publish" version "latest.release" - id "net.ltgt.errorprone" version "latest.release" } allprojects { @@ -22,14 +22,14 @@ tasks.withType(JavaCompile).configureEach { // ? gradle.projectsEvaluated { options.release.set(17) options.deprecation = true - options.errorprone { - enabled = true // << Date: Mon, 31 Mar 2025 19:18:32 +0300 Subject: [PATCH 13/17] cleanup --- build.gradle | 1 + .../trivago/kangaroo/AbstractCommonBenchHelper.java | 10 +++++----- .../kangaroo/FastutilWrapperBusyWaitingBenchmark.java | 3 +-- .../kangaroo/FastutilWrapperDefaultBenchmark.java | 1 - .../com/trivago/kangaroo/JavaUtilWrapperBenchmark.java | 4 +++- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/build.gradle b/build.gradle index 527ac78..3da94eb 100644 --- a/build.gradle +++ b/build.gradle @@ -85,6 +85,7 @@ dependencies { testImplementation 'org.junit.jupiter:junit-jupiter-api:5.11.+' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.11.+' + testImplementation 'org.junit.vintage:junit-vintage-engine:5.11.+' } test { diff --git a/src/jmh/java/com/trivago/kangaroo/AbstractCommonBenchHelper.java b/src/jmh/java/com/trivago/kangaroo/AbstractCommonBenchHelper.java index 091f500..af4fa41 100644 --- a/src/jmh/java/com/trivago/kangaroo/AbstractCommonBenchHelper.java +++ b/src/jmh/java/com/trivago/kangaroo/AbstractCommonBenchHelper.java @@ -8,7 +8,7 @@ import java.util.concurrent.TimeUnit; -abstract public class AbstractCommonBenchHelper { +public abstract class AbstractCommonBenchHelper { @Threads(4) @Benchmark @BenchmarkMode(Mode.Throughput) @@ -54,9 +54,9 @@ public void testRandomAllOpsAvgTime() { testAllOps(); } - abstract public void testGet(); + public abstract void testGet(); - abstract public void testPut(); + public abstract void testPut(); - abstract public void testAllOps(); -} + public abstract void testAllOps(); +} \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/FastutilWrapperBusyWaitingBenchmark.java b/src/jmh/java/com/trivago/kangaroo/FastutilWrapperBusyWaitingBenchmark.java index 8a83c00..963163f 100644 --- a/src/jmh/java/com/trivago/kangaroo/FastutilWrapperBusyWaitingBenchmark.java +++ b/src/jmh/java/com/trivago/kangaroo/FastutilWrapperBusyWaitingBenchmark.java @@ -12,9 +12,8 @@ @Warmup(iterations = 3, time = 1) @Measurement(iterations = 3, time = 2) public class FastutilWrapperBusyWaitingBenchmark extends AbstractBenchHelper { - @Setup(Level.Trial) public void loadData() { - super.initAndLoadData(PrimitiveMapBuilder.MapMode.BUSY_WAITING); + initAndLoadData(PrimitiveMapBuilder.MapMode.BUSY_WAITING); } } \ No newline at end of file diff --git a/src/jmh/java/com/trivago/kangaroo/FastutilWrapperDefaultBenchmark.java b/src/jmh/java/com/trivago/kangaroo/FastutilWrapperDefaultBenchmark.java index 5e05b62..d51d86f 100644 --- a/src/jmh/java/com/trivago/kangaroo/FastutilWrapperDefaultBenchmark.java +++ b/src/jmh/java/com/trivago/kangaroo/FastutilWrapperDefaultBenchmark.java @@ -12,7 +12,6 @@ @Warmup(iterations = 3, time = 1) @Measurement(iterations = 3, time = 2) public class FastutilWrapperDefaultBenchmark extends AbstractBenchHelper { - @Setup(Level.Trial) public void loadData() { initAndLoadData(PrimitiveMapBuilder.MapMode.BLOCKING); diff --git a/src/jmh/java/com/trivago/kangaroo/JavaUtilWrapperBenchmark.java b/src/jmh/java/com/trivago/kangaroo/JavaUtilWrapperBenchmark.java index 8e3a997..458788e 100644 --- a/src/jmh/java/com/trivago/kangaroo/JavaUtilWrapperBenchmark.java +++ b/src/jmh/java/com/trivago/kangaroo/JavaUtilWrapperBenchmark.java @@ -12,11 +12,13 @@ import java.util.Map; import java.util.concurrent.ThreadLocalRandom; +/** + JDK Collections.synchronizedMap(Long2LongOpenHashMap) +*/ @State(Scope.Benchmark) @Warmup(iterations = 3, time = 1) @Measurement(iterations = 3, time = 2) public class JavaUtilWrapperBenchmark extends AbstractCommonBenchHelper { - Map map; @Setup(Level.Trial) From 1d765582ac5f3bd4216236a5248f1aeb0052c9df Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 19:35:44 +0300 Subject: [PATCH 14/17] jitpack.io --- jitpack.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 jitpack.yml diff --git a/jitpack.yml b/jitpack.yml new file mode 100644 index 0000000..cc276a8 --- /dev/null +++ b/jitpack.yml @@ -0,0 +1,5 @@ +jdk: + - openjdk17 + +install: + - gradle clean build publishToMavenLocal --console=plain --continue --warning-mode all \ No newline at end of file From 85a70d3c1a28650d75dc1d0a3173b3c75cc0e5ee Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 19:37:07 +0300 Subject: [PATCH 15/17] gradle wrapper 8.13 --- gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43705 bytes gradlew | 251 ++++++++++++++++++++++++++++++ gradlew.bat | 94 +++++++++++ 3 files changed, 345 insertions(+) create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradlew create mode 100644 gradlew.bat diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..9bbc975c742b298b441bfb90dbc124400a3751b9 GIT binary patch literal 43705 zcma&Obx`DOvL%eWOXJW;V64viP??$)@wHcsJ68)>bJS6*&iHnskXE8MjvIPVl|FrmV}Npeql07fCw6`pw`0s zGauF(<*@v{3t!qoUU*=j)6;|-(yg@jvDx&fV^trtZt27?4Tkn729qrItVh@PMwG5$ z+oXHSPM??iHZ!cVP~gYact-CwV`}~Q+R}PPNRy+T-geK+>fHrijpllon_F4N{@b-} z1M0=a!VbVmJM8Xk@NRv)m&aRYN}FSJ{LS;}2ArQ5baSjfy40l@T5)1r-^0fAU6f_} zzScst%$Nd-^ElV~H0TetQhMc%S{}Q4lssln=|;LG?Ulo}*mhg8YvBAUY7YFdXs~vv zv~{duzVw%C#GxkBwX=TYp1Dh*Uaum2?RmsvPaLlzO^fIJ`L?&OV?Y&kKj~^kWC`Ly zfL-}J^4a0Ojuz9O{jUbIS;^JatJ5+YNNHe}6nG9Yd6P-lJiK2ms)A^xq^H2fKrTF) zp!6=`Ece~57>^9(RA4OB9;f1FAhV%zVss%#rDq$9ZW3N2cXC7dMz;|UcRFecBm`DA z1pCO!#6zKp#@mx{2>Qcme8y$Qg_gnA%(`Vtg3ccwgb~D(&@y8#Jg8nNYW*-P{_M#E zZ|wCsQoO1(iIKd-2B9xzI}?l#Q@G5d$m1Lfh0q;iS5FDQ&9_2X-H)VDKA*fa{b(sV zL--krNCXibi1+*C2;4qVjb0KWUVGjjRT{A}Q*!cFmj0tRip2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file mode 100644 index 0000000..faf9300 --- /dev/null +++ b/gradlew @@ -0,0 +1,251 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..9d21a21 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega From 8dca9dd4b6177f66189157feaddba3380ff1ca88 Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 19:37:53 +0300 Subject: [PATCH 16/17] v0.3 --- gradle.properties | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 5deb24b..ba62215 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,6 @@ -group = 'com.trivago' -version = '0.2.3-SNAPSHOT' +group = com.trivago + +version = 0.3 org.gradle.jvmargs = -ea -Dfile.encoding=UTF-8 -XX:+UseG1GC -Xms512m -Xmx1G -Djava.net.preferIPv4Stack=true systemProp.file.encoding = UTF-8 From 23174be8c7ca488e2641a546ae329c6bf8553d88 Mon Sep 17 00:00:00 2001 From: "A.Fink" Date: Mon, 31 Mar 2025 19:38:56 +0300 Subject: [PATCH 17/17] v0.3.0 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index ba62215..027cb4b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ group = com.trivago -version = 0.3 +version = 0.3.0 org.gradle.jvmargs = -ea -Dfile.encoding=UTF-8 -XX:+UseG1GC -Xms512m -Xmx1G -Djava.net.preferIPv4Stack=true systemProp.file.encoding = UTF-8