bloritsch 2002/06/26 13:20:46
Modified: collections build.xml
collections/src/test/org/apache/avalon/excalibur/collections/test
ThreadedMapTest.java
Log:
make test a little more fair
Revision Changes Path
1.21 +2 -1 jakarta-avalon-excalibur/collections/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/collections/build.xml,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- build.xml 22 Jun 2002 16:35:00 -0000 1.20
+++ build.xml 26 Jun 2002 20:20:46 -0000 1.21
@@ -175,7 +175,8 @@
<batchtest todir="${build.tests}">
<fileset dir="${build.testclasses}">
- <include name="**/test/*TestCase.class"/>
+ <include name="**/test/*TestCase.class"/>
+ <include name="**/test/*Test.class"/>
<exclude name="**/Abstract*"/>
</fileset>
</batchtest>
1.3 +10 -2
jakarta-avalon-excalibur/collections/src/test/org/apache/avalon/excalibur/collections/test/ThreadedMapTest.java
Index: ThreadedMapTest.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/collections/src/test/org/apache/avalon/excalibur/collections/test/ThreadedMapTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ThreadedMapTest.java 26 Jun 2002 18:54:42 -0000 1.2
+++ ThreadedMapTest.java 26 Jun 2002 20:20:46 -0000 1.3
@@ -26,7 +26,7 @@
public class ThreadedMapTest extends TestCase
{
private static final int ITERATIONS = 10000;
- private static final int THREADS = 100;
+ private static final int THREADS = 20;
private MapStart start;
@@ -57,12 +57,20 @@
System.out.println("Unsized BucketMap (255 buckets) took " + (end -
start) + "ms");
System.out.println("Thats " + ( (float)(end - start) /
(float)(ITERATIONS * THREADS) ) + "ms per operation");
+ initialize( ITERATIONS, THREADS, Collections.synchronizedMap(new
HashMap(((ITERATIONS / 2) + 1))) );
+ start = System.currentTimeMillis();
+ start();
+ end = System.currentTimeMillis();
+
+ System.out.println("Synchronized (sized) HashMap took " + (end -
start) + "ms");
+ System.out.println("Thats " + ( (float)(end - start) /
(float)(ITERATIONS * THREADS) ) + "ms per operation");
+
initialize( ITERATIONS, THREADS, Collections.synchronizedMap(new
HashMap()) );
start = System.currentTimeMillis();
start();
end = System.currentTimeMillis();
- System.out.println("Synchronized HashMap took " + (end - start) +
"ms");
+ System.out.println("Synchronized (unsized) HashMap took " + (end -
start) + "ms");
System.out.println("Thats " + ( (float)(end - start) /
(float)(ITERATIONS * THREADS) ) + "ms per operation");
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>