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.36 by jsr166, Sun Mar 25 18:57:41 2018 UTC vs.
Revision 1.37 by jsr166, Sun Mar 25 19:00:09 2018 UTC

# Line 503 | Line 503 | public class IteratorMicroBenchmark {
503                      check.sum(sumFunction.applyAsInt(x));}}};
504      }
505  
506 //     Job subListJob(String name, List<Integer> x, ToIntFunction<List<Integer>> sumFunction) {
507 //         final String klazz = goodClassName(x.getClass());
508 //         final int size = x.size(), half = size / 2;
509 //         return new Job(klazz + " ToIntFunction subList " + name) {
510 //             public void work() throws Throwable {
511 //                 for (int i = 0; i < iterations; i++) {
512 //                     int total = Stream.of(x.subList(0, half),
513 //                                           x.subList(half, size))
514 //                         .mapToInt(sumFunction::applyAsInt)
515 //                         .sum();
516 //                     check.sum(total);}}};
517 //     }
518
506      Stream<Job> listJobs(List<Integer> x) {
507          final String klazz = goodClassName(x.getClass());
508          final int[] sneakySum = new int[1];
# Line 534 | Line 521 | public class IteratorMicroBenchmark {
521                      sneakySum[0] = 0;
522                      if (z.lastIndexOf(sneakyAdder) != -1) throw new AssertionError();
523                      return sneakySum[0]; }));
537
538 //         final int size = x.size(), half = size / 2;
539 //         ToIntFunction<List<Integer>> indexOf = z -> {
540 //             sneakySum[0] = 0;
541 //             if (z.indexOf(sneakyAdder) != -1) throw new AssertionError();
542 //             return sneakySum[0]; };
543 //         ToIntFunction<List<Integer>> lastIndexOf = z -> {
544 //             sneakySum[0] = 0;
545 //             if (z.lastIndexOf(sneakyAdder) != -1) throw new AssertionError();
546 //             return sneakySum[0]; };
547
548 //         return Stream.of(
549 //             subListJob("toArray()", x, subList -> {
550 //                            int sum = 0;
551 //                            for (Object o : subList.toArray())
552 //                                sum += (Integer) o;
553 //                            return sum; }),
554 //             subListJob("toArray(a)", x, subList -> {
555 //                            int sum = 0;
556 //                            Integer[] a = new Integer[subList.size()];
557 //                            for (Object o : subList.toArray(a))
558 //                                sum += (Integer) o;
559 //                            return sum; }),
560 //             subListJob("toArray(empty)", x, subList -> {
561 //                 int sum = 0;
562 //                 Integer[] a = new Integer[0];
563 //                 for (Object o : subList.toArray(a))
564 //                     sum += (Integer) o;
565 //                 return sum; }),
566 //             subListJob("contains", x, subList -> {
567 //                 sneakySum[0] = 0;
568 //                 if (subList.contains(sneakyAdder)) throw new AssertionError();
569 //                 return sneakySum[0]; }),
570 //             subListJob("forEach", x, subList -> {
571 //                 sneakySum[0] = 0;
572 //                 subList.forEach(n -> sneakySum[0] += n);
573 //                 return sneakySum[0]; }),
574 //             subListJob("stream().forEach", x, subList -> {
575 //                 sneakySum[0] = 0;
576 //                 subList.stream().forEach(n -> sneakySum[0] += n);
577 //                 return sneakySum[0]; }),
578 //             iterateJob("indexOf", x, indexOf),
579 //             subListJob("indexOf", x, indexOf),
580 //             iterateJob("lastIndexOf", x, lastIndexOf),
581 //             subListJob("lastIndexOf", x, lastIndexOf));
524      }
525   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines