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.40 by jsr166, Mon Apr 2 20:32:53 2018 UTC vs.
Revision 1.41 by jsr166, Tue Apr 3 19:07:36 2018 UTC

# Line 503 | Line 503 | public class IteratorMicroBenchmark {
503      Stream<Job> listJobs(List<Integer> x) {
504          final String klazz = goodClassName(x.getClass());
505          return Stream.of(
506 +            new Job(klazz + " listIterator forward loop") {
507 +                public void work() throws Throwable {
508 +                    for (int i = 0; i < iterations; i++) {
509 +                        int sum = 0;
510 +                        ListIterator<Integer> it = x.listIterator();
511 +                        while (it.hasNext())
512 +                            sum += it.next();
513 +                        check.sum(sum);}}},
514 +            new Job(klazz + " listIterator backward loop") {
515 +                public void work() throws Throwable {
516 +                    for (int i = 0; i < iterations; i++) {
517 +                        int sum = 0;
518 +                        ListIterator<Integer> it = x.listIterator(x.size());
519 +                        while (it.hasPrevious())
520 +                            sum += it.previous();
521 +                        check.sum(sum);}}},
522              new Job(klazz + " indexOf") {
523                  public void work() throws Throwable {
524                      int[] sum = new int[1];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines