ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/BoxedLongSort.java
(Generate patch)

Comparing jsr166/src/test/loops/BoxedLongSort.java (file contents):
Revision 1.12 by jsr166, Mon Aug 10 03:13:33 2015 UTC vs.
Revision 1.13 by dl, Sat Sep 12 18:12:20 2015 UTC

# Line 16 | Line 16 | class BoxedLongSort {
16      public static void main(String[] args) throws Exception {
17          int procs = 0;
18          int n = 1 << 22;
19 <        int reps = 20;
19 >        int reps = 30;
20          int sreps = 2;
21          try {
22              if (args.length > 0)
# Line 45 | Line 45 | class BoxedLongSort {
45          for (int i = 0; i < n; ++i)
46              numbers[i] = Long.valueOf(i);
47          Long[] a = new Long[n];
48 <        ForkJoinPool pool = new ForkJoinPool(procs);
48 >        //        ForkJoinPool pool = new ForkJoinPool(procs);
49 >        ForkJoinPool pool = ForkJoinPool.commonPool();
50          seqTest(a, numbers, pool, 1);
51          System.out.println(pool);
52          parTest(a, numbers, pool, reps);
# Line 60 | Line 61 | class BoxedLongSort {
61          System.out.printf("Sorting %d longs, %d replications\n", n, reps);
62          long start = System.nanoTime();
63          for (int i = 0; i < reps; ++i) {
64 <            pool.invoke(new RandomRepacker(numbers, a, 0, n, n));
64 >            new RandomRepacker(numbers, a, 0, n, n).invoke();
65              //            pool.invoke(new TaskChecker());
66              long last = System.nanoTime();
67              //            quickSort(a, 0, n-1);
# Line 75 | Line 76 | class BoxedLongSort {
76          }
77      }
78  
79 <    static void parTest(Long[] a, Long[] numbers, ForkJoinPool pool, int reps) {
79 >    static void parTest(Long[] a, Long[] numbers, ForkJoinPool pool, int reps) throws Exception {
80          int n = numbers.length;
81          Long[] w = new Long[n];
82          System.out.printf("Sorting %d longs, %d replications\n", n, reps);
83          long start = System.nanoTime();
84          for (int i = 0; i < reps; ++i) {
85              //            Arrays.fill(w, 0, n, null);
86 <            pool.invoke(new RandomRepacker(numbers, a, 0, n, n));
86 >            new RandomRepacker(numbers, a, 0, n, n).invoke();
87 >            //            Thread.sleep(500);
88              //            pool.invoke(new TaskChecker());
89              long last = System.nanoTime();
90 <            pool.invoke(new Sorter(a, w, 0, n));
90 >            new Sorter(a, w, 0, n).invoke();
91              long now = System.nanoTime();
92              //            pool.invoke(new TaskChecker());
93              double total = (double)(now - start) / NPS;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines