ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/jtreg/util/Collection/IteratorMicroBenchmark.java
(Generate patch)

Comparing jsr166/src/test/jtreg/util/Collection/IteratorMicroBenchmark.java (file contents):
Revision 1.41 by jsr166, Tue Apr 3 19:07:36 2018 UTC vs.
Revision 1.42 by jsr166, Thu Apr 5 05:23:16 2018 UTC

# Line 56 | Line 56 | import java.util.concurrent.CountDownLat
56   import java.util.concurrent.ThreadLocalRandom;
57   import java.util.concurrent.TimeUnit;
58   import java.util.concurrent.atomic.LongAdder;
59 + import java.util.function.UnaryOperator;
60   import java.util.regex.Pattern;
61   import java.util.stream.Stream;
62  
# Line 536 | Line 537 | public class IteratorMicroBenchmark {
537                          sum[0] = 0;
538                          if (x.lastIndexOf(sneakyAdder) != -1)
539                              throw new AssertionError();
540 +                        check.sum(sum[0]);}}},
541 +            new Job(klazz + " replaceAll") {
542 +                public void work() throws Throwable {
543 +                    int[] sum = new int[1];
544 +                    UnaryOperator<Integer> sneakyAdder =
545 +                        x -> { sum[0] += x; return x; };
546 +                    for (int i = 0; i < iterations; i++) {
547 +                        sum[0] = 0;
548 +                        x.replaceAll(sneakyAdder);
549                          check.sum(sum[0]);}}});
550      }
551   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines