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

Comparing jsr166/src/test/jtreg/util/Collection/RemoveMicroBenchmark.java (file contents):
Revision 1.9 by jsr166, Tue Dec 27 21:08:45 2016 UTC vs.
Revision 1.10 by jsr166, Thu Dec 29 18:11:57 2016 UTC

# Line 389 | Line 389 | public class RemoveMicroBenchmark {
389                              it.remove();
390                          }
391                          check.sum(sum[0]);}}},
392 +            new Job(description + " Iterator.remove-rnd-two-pass") {
393 +                public void work() throws Throwable {
394 +                    ThreadLocalRandom rnd = ThreadLocalRandom.current();
395 +                    Collection<Integer> x = supplier.get();
396 +                    int[] sum = new int[1];
397 +                    for (int i = 0; i < iterations; i++) {
398 +                        sum[0] = 0;
399 +                        x.addAll(al);
400 +                        Iterator<Integer> it = x.iterator();
401 +                        while (it.hasNext()) {
402 +                            if (rnd.nextBoolean()) {
403 +                                sum[0] += it.next();
404 +                                it.remove();
405 +                            }
406 +                        }
407 +                        while (it.hasNext()) {
408 +                            sum[0] += it.next();
409 +                            it.remove();
410 +                        }
411 +                        it = x.iterator();
412 +                        check.sum(sum[0]);}}},
413              new Job(description + " clear") {
414                  public void work() throws Throwable {
415                      Collection<Integer> x = supplier.get();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines