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.19 by jsr166, Sat Apr 15 02:06:03 2017 UTC vs.
Revision 1.20 by jsr166, Sat Apr 15 02:15:43 2017 UTC

# Line 408 | Line 408 | public class IteratorMicroBenchmark {
408                      for (int i = 0; i < iterations; i++) {
409                          check.sum(x.stream()
410                                    .collect(summingInt(e -> e)));}}},
411 +            new Job(klazz + " stream().iterator()") {
412 +                public void work() throws Throwable {
413 +                    int[] sum = new int[1];
414 +                    for (int i = 0; i < iterations; i++) {
415 +                        sum[0] = 0;
416 +                        for (Integer o : (Iterable<Integer>) x.stream()::iterator)
417 +                            sum[0] += o;
418 +                        check.sum(sum[0]);}}},
419              new Job(klazz + " parallelStream().forEach") {
420                  public void work() throws Throwable {
421                      for (int i = 0; i < iterations; i++) {
# Line 422 | Line 430 | public class IteratorMicroBenchmark {
430                  public void work() throws Throwable {
431                      for (int i = 0; i < iterations; i++) {
432                          check.sum(x.parallelStream()
433 <                                  .collect(summingInt(e -> e)));}}});
433 >                                  .collect(summingInt(e -> e)));}}},
434 >            new Job(klazz + " stream().iterator()") {
435 >                public void work() throws Throwable {
436 >                    int[] sum = new int[1];
437 >                    for (int i = 0; i < iterations; i++) {
438 >                        sum[0] = 0;
439 >                        for (Integer o : (Iterable<Integer>) x.parallelStream()::iterator)
440 >                            sum[0] += o;
441 >                        check.sum(sum[0]);}}});
442      }
443  
444      List<Job> dequeJobs(Deque<Integer> x) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines