ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/MapWordLoops.java
(Generate patch)

Comparing jsr166/src/test/loops/MapWordLoops.java (file contents):
Revision 1.2 by dl, Mon May 9 19:33:30 2005 UTC vs.
Revision 1.4 by dl, Fri Oct 23 19:57:06 2009 UTC

# Line 13 | Line 13 | public class MapWordLoops {
13          "class.txt",
14          "dir.txt",
15          "ids.txt",
16 <        "/usr/dict/words",
16 >        "testwords.txt",
17 >        //        "/usr/dict/words",
18      };
19  
20      static final int MAX_WORDS = 500000;
21      static final int pinsert   = 60;
22 <    static final int premove   = 1;
23 <    static final int NOPS      = 5000000;
22 >    static final int premove   = 2;
23 >    static final int NOPS      = 8000000;
24 >
25      static final int numTests = 3;
26  
27      public static void main(String[] args) {
# Line 50 | Line 52 | public class MapWordLoops {
52              
53              for (int i = 0; i < numTests; ++i) {
54                  Map<String,String> m = newMap(mapClass);
55 <                long t = doTest(mapClass.getName(), m, key);
55 >                long t = doTest(i, mapClass.getName(), m, key);
56                  if (t < least) least = t;
57                  m.clear();
58                  m = null;
# Line 104 | Line 106 | public class MapWordLoops {
106          return array;
107      }
108  
109 <    static long doTest(String name,
109 >    static long doTest(int id, String name,
110                         final Map<String,String> m,
111                         final String[] key) {
112  
113          //    System.out.print(name + "\t");
114 <        Runner runner = new Runner(m, key);
114 >        Runner runner = new Runner(id, m, key);
115          long startTime = System.currentTimeMillis();
116          runner.run();
117          long afterRun = System.currentTimeMillis();
# Line 128 | Line 130 | public class MapWordLoops {
130      static class Runner implements Runnable {
131          final Map<String,String> map;
132          final String[] key;
133 <        LoopHelpers.SimpleRandom rng = new LoopHelpers.SimpleRandom();
133 >        LoopHelpers.SimpleRandom rng;
134          final int pctrem;
135          final int pctins;
136          int nputs = 0;
# Line 138 | Line 140 | public class MapWordLoops {
140          volatile int total;
141          int maxsz;
142  
143 <        Runner(Map<String,String> m, String[] k) {
143 >        Runner(int id, Map<String,String> m, String[] k) {
144              map = m; key = k;
145              pctrem = (int)(((long)premove * (long)(Integer.MAX_VALUE/2)) / 50);
146              pctins = (int)(((long)pinsert * (long)(Integer.MAX_VALUE/2)) / 50);
147 +            rng = new LoopHelpers.SimpleRandom((id + 1) * 8862213513L);
148          }
149  
150  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines