summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-07-02 02:35:07 +0300
committerSven Gothel <[email protected]>2010-07-02 02:35:07 +0300
commit8a95808d3762ee4645dd5de1f0b0844c254e8638 (patch)
tree293373f0db58abf7d2af8cb5a618930418d94fdc
parent84cb317038aec9aeb3a407404eac0831b5fe75ea (diff)
Fix: Add missing imports; Add warmup phase to primitive hashmap test
-rw-r--r--src/java/com/jogamp/common/os/Platform.java2
-rw-r--r--src/junit/com/jogamp/common/util/IntIntHashMapTest.java13
-rw-r--r--src/junit/com/jogamp/common/util/LongIntHashMapTest.java13
3 files changed, 22 insertions, 6 deletions
diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java
index f31ca6c..2dc4532 100644
--- a/src/java/com/jogamp/common/os/Platform.java
+++ b/src/java/com/jogamp/common/os/Platform.java
@@ -34,6 +34,8 @@ import com.jogamp.common.nio.Buffers;
import java.nio.ByteBuffer;
import java.nio.IntBuffer;
import java.nio.ShortBuffer;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
/**
* Utility class for querying platform specific properties.
diff --git a/src/junit/com/jogamp/common/util/IntIntHashMapTest.java b/src/junit/com/jogamp/common/util/IntIntHashMapTest.java
index bc02947..9d58db0 100644
--- a/src/junit/com/jogamp/common/util/IntIntHashMapTest.java
+++ b/src/junit/com/jogamp/common/util/IntIntHashMapTest.java
@@ -105,6 +105,11 @@ public class IntIntHashMapTest {
@Test
public void benchmark() {
+ benchmark(true);
+ benchmark(false);
+ }
+
+ void benchmark(boolean warmup) {
// simple benchmark
final IntIntHashMap intmap = new IntIntHashMap(1024);
@@ -158,9 +163,11 @@ public class IntIntHashMapTest {
map.remove(rndValues[i]);
}
- assertTrue("'put' to slow", intmapPutTime <= mapPutTime);
- assertTrue("'get' to slow", intmapGetTime <= mapGetTime);
- assertTrue("'remove' to slow", intmapRemoveTime <= mapRemoveTime);
+ if(!warmup) {
+ assertTrue("'put' too slow", intmapPutTime <= mapPutTime);
+ assertTrue("'get' too slow", intmapGetTime <= mapGetTime);
+ assertTrue("'remove' too slow", intmapRemoveTime <= mapRemoveTime);
+ }
}
diff --git a/src/junit/com/jogamp/common/util/LongIntHashMapTest.java b/src/junit/com/jogamp/common/util/LongIntHashMapTest.java
index b51211c..7fc8978 100644
--- a/src/junit/com/jogamp/common/util/LongIntHashMapTest.java
+++ b/src/junit/com/jogamp/common/util/LongIntHashMapTest.java
@@ -105,6 +105,11 @@ public class LongIntHashMapTest {
@Test
public void benchmark() {
+ benchmark(true);
+ benchmark(false);
+ }
+
+ void benchmark(boolean warmup) {
// simple benchmark
final LongIntHashMap intmap = new LongIntHashMap(1024);
@@ -158,9 +163,11 @@ public class LongIntHashMapTest {
map.remove(rndValues[i]);
}
- assertTrue("'put' to slow", intmapPutTime <= mapPutTime);
- assertTrue("'get' to slow", intmapGetTime <= mapGetTime);
- assertTrue("'remove' to slow", intmapRemoveTime <= mapRemoveTime);
+ if(!warmup) {
+ assertTrue("'put' too slow", intmapPutTime <= mapPutTime);
+ assertTrue("'get' too slow", intmapGetTime <= mapGetTime);
+ assertTrue("'remove' too slow", intmapRemoveTime <= mapRemoveTime);
+ }
}