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

Comparing jsr166/src/test/loops/IntegerMax.java (file contents):
Revision 1.3 by dl, Fri Mar 22 18:41:30 2013 UTC vs.
Revision 1.6 by jsr166, Wed Dec 31 17:00:58 2014 UTC

# Line 5 | Line 5
5   */
6  
7   import java.util.*;
8 import java.util.function.*;
8   import java.util.concurrent.*;
9   import java.util.concurrent.atomic.*;
10 + import java.util.function.*;
11  
12   public class IntegerMax {
13      static final int SIZE = 1000000;
# Line 76 | Line 76 | public class IntegerMax {
76          ctest(new TreeSet<Integer>(), vlist, vmax, size, trials);
77          ctest(new ConcurrentSkipListSet<Integer>(), klist, kmax, size, trials);
78          ctest(new ConcurrentSkipListSet<Integer>(), vlist, vmax, size, trials);
79 <        
79 >
80          mtest(new HashMap<Integer,Integer>(), keys, vals, kmax, vmax, size, trials);
81          mtest(new IdentityHashMap<Integer,Integer>(), keys, vals, kmax, vmax, size, trials);
82          mtest(new WeakHashMap<Integer,Integer>(), keys, vals, kmax, vmax, size, trials);
83          mtest(new ConcurrentHashMap<Integer,Integer>(), keys, vals, kmax, vmax, size, trials);
84 <        
84 >
85          mtest(new TreeMap<Integer,Integer>(), keys, vals, kmax, vmax, size, trials);
86          mtest(new ConcurrentSkipListMap<Integer,Integer>(), keys, vals, kmax, vmax, size, trials);
87 <    
87 >
88          if (allClasses) {
89              mtest(new Hashtable<Integer,Integer>(), keys, vals, kmax, vmax, size, trials);
90              mtest(new LinkedHashMap<Integer,Integer>(), keys, vals, kmax, vmax, size, trials);
# Line 173 | Line 173 | public class IntegerMax {
173      static long itest(Collection<Integer> c, int max, int trials) throws Exception {
174          if (c == null) throw new Error();
175          Thread.sleep(250);
176 <        long tlast =  System.nanoTime();
176 >        long tlast = System.nanoTime();
177          for (int i = 0; i < trials; ++i) {
178              Integer pmax = Integer.valueOf(Integer.MIN_VALUE - checksum.get());
179              for (Integer x : c)
# Line 186 | Line 186 | public class IntegerMax {
186      static long stest(Collection<Integer> c, int max, int trials) throws Exception {
187          if (c == null) throw new Error();
188          Thread.sleep(250);
189 <        long tlast =  System.nanoTime();
189 >        long tlast = System.nanoTime();
190          for (int i = 0; i < trials; ++i) {
191              int pmax = c.stream().reduce
192                  (Integer.valueOf(Integer.MIN_VALUE - checksum.get()), MAX);
# Line 198 | Line 198 | public class IntegerMax {
198      static long ptest(Collection<Integer> c, int max, int trials) throws Exception {
199          if (c == null) throw new Error();
200          Thread.sleep(250);
201 <        long tlast =  System.nanoTime();
201 >        long tlast = System.nanoTime();
202          for (int i = 0; i < trials; ++i) {
203              int pmax = c.parallelStream().reduce
204                  (Integer.valueOf(Integer.MIN_VALUE - checksum.get()), MAX);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines