|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectN08_Part2_DataStructureAccess
public class N08_Part2_DataStructureAccess
For the article Robust Java benchmarking, Part 2: Statistics And solutions, contains the code relevant to Figure 3, Figure 4, Figure 5, Listing 2, and Listing 3.
Field Summary | |
---|---|
protected static String[] |
classnamePrefixes
Specifies the prefixes of the class names of all the task classes that will be benchmarked by main . |
protected static Integer[] |
integers
Global variable used by the various data structure access task classes like N08_Part2_DataStructureAccess.ArrayAccessSequential . |
Constructor Summary | |
---|---|
N08_Part2_DataStructureAccess()
|
Method Summary | |
---|---|
protected static Runnable |
createTask(String prefix,
String mode)
|
protected static void |
examineConcurrentHashMapAnomaly(String mode)
This method was written to more thoroughly examine the ConcurrentHashMap case 1 versus case 2 anomaly noted in the article as a function of many more element sizes. |
static void |
main(String[] args)
Results on 2008/3/27 on my 2.2 GHz Intel Core 2 Duo E4500 machine (server jvm): see these files:
.. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static String[] classnamePrefixes
main
.
The classes must all be inner classes of this class.
The suffix of their class name must be specified as the 2nd elements of the args parameter of main.
protected static Integer[] integers
N08_Part2_DataStructureAccess.ArrayAccessSequential
.
Is declared as a field here instead of as a field/local variable in the classes below because
Constructor Detail |
---|
public N08_Part2_DataStructureAccess()
Method Detail |
---|
public static void main(String[] args) throws Exception
../results/N08_Part2_DataStructureAccess_Desktop_1024_Sequential.txt
../results/N08_Part2_DataStructureAccess_Desktop_1024_Random.txt
../results/N08_Part2_DataStructureAccess_Desktop_1024X1024_Sequential.txt
../results/N08_Part2_DataStructureAccess_Desktop_1024X1024_Random.txt
Results on 2008/3/27 on my 1.167 GHz SPARC-Enterprise-T5220 machine (server jvm): see these files:
../results/N08_Part2_DataStructureAccess_N2_1024_Sequential.txt
../results/N08_Part2_DataStructureAccess_N2_1024X1024_Sequential.txt
Note: the N2 results are CPU times, not elapsed times (since the tests are all single threaded and Solaris supports this so well)
The files mentioned above are the full text of the raw program output. Edited versions of the relevant data (i.e. just the means) of all of the above results, plus all of the associated Figures in the article, are found in this spreadsheet:
../results/N08_Part2_DataStructureAccess.xls
args
- must be non-null and have exactly 2 elements:
args[0] must be an int that specifies the size of the integers array,
args[1] must be either the String Sequential
or the String Random
(it specifies how the elements of the integer array will be accessed)
Exception
protected static Runnable createTask(String prefix, String mode) throws Exception
Exception
protected static void examineConcurrentHashMapAnomaly(String mode) throws Exception
Results on 2008/5/2 on my 2.2 GHz Intel Core 2 Duo E4500 machine (server jvm):
m case 1 case 2
1 29.798 ns 32.366 ns
2 28.773 ns 30.201 ns
4 28.266 ns 25.859 ns
8 25.361 ns 23.530 ns
16 27.614 ns 24.478 ns
32 30.415 ns 26.797 ns
64 28.893 ns 26.729 ns
128 29.057 ns 27.718 ns
256 27.707 ns 27.575 ns
512 28.846 ns 27.002 ns
1024 31.326 ns 28.998 ns
2048 34.486 ns 33.871 ns
4096 33.757 ns 32.865 ns
8192 35.414 ns 35.299 ns
16384 35.290 ns 34.653 ns
32768 36.722 ns 35.705 ns
65536 71.930 ns 65.732 ns
131072 124.900 ns 116.707 ns
262144 158.120 ns 137.651 ns
524288 174.524 ns 159.670 ns
1048576 182.828 ns 164.059 ns
2097152 194.498 ns 174.439 ns
4194304 200.627 ns 172.409 ns
8388608 211.306 ns 184.544 ns
The above shows that the anomaly is always present, regardless of the size of the number of elements, which differs from what I found on an earlier run...
+++ try another run...
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |