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

Comparing jsr166/src/test/loops/MapMicroBenchmark.java (file contents):
Revision 1.9 by jsr166, Wed Sep 1 07:20:36 2010 UTC vs.
Revision 1.14 by jsr166, Wed Mar 5 17:31:06 2014 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   import java.util.*;
# Line 147 | Line 147 | public class MapMicroBenchmark {
147      }
148  
149      static void runWork(Job[] jobs, int minIters, int maxIters, long timeLimit) throws Throwable {
150 <        for (int k = 0; k <  nsizes; ++k) {
150 >        for (int k = 0; k < nsizes; ++k) {
151              int len = sizes[k];
152              for (int i = 0; i < jobs.length; i++) {
153                  Thread.sleep(50);
# Line 160 | Line 160 | public class MapMicroBenchmark {
160  
161      // First warmup -- run only mixed job to discourage type specialization
162      static void warmup1(Job job) throws Throwable {
163 <        for (int k = 0; k <  nsizes; ++k)
163 >        for (int k = 0; k < nsizes; ++k)
164              job.work(sizes[k], 1, 1, 0);
165      }
166  
# Line 334 | Line 334 | public class MapMicroBenchmark {
334                      if (m.put(x, x) == null)
335                          ++sum;
336                  }
337 +                /*  // uncomment to avoid calling clear()
338 +                for (int i = 0; i < len; ++i) {
339 +                    Object x = keys[i];
340 +                    m.remove(x);
341 +                }
342 +                */
343                  m.clear();
344                  sum += len - (quarter * 2);
345                  checkSum += sum ^ (sum << 12);
# Line 377 | Line 383 | public class MapMicroBenchmark {
383  
384      // plain array shuffle
385      static void shuffle(Object[] a, int size) {
386 <        for (int i= size; i>1; i--) {
386 >        for (int i = size; i > 1; i--) {
387              Object t = a[i-1];
388              int r = rng.nextInt(i);
389              a[i-1] = a[r];
# Line 438 | Line 444 | public class MapMicroBenchmark {
444  
445          BufferedInputStream in = new BufferedInputStream(fr);
446          int k = 0;
447 <        outer:while (k < n) {
447 >        outer: while (k < n) {
448              StringBuffer sb = new StringBuffer();
449              for (;;) {
450                  int c = in.read();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines