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

Comparing jsr166/src/test/loops/CCBoxedLongSort.java (file contents):
Revision 1.1 by dl, Mon Apr 9 13:18:06 2012 UTC vs.
Revision 1.2 by jsr166, Sat May 5 17:09:23 2012 UTC

# Line 68 | Line 68 | class CCBoxedLongSort {
68              long now = System.nanoTime();
69              double total = (double)(now - start) / NPS;
70              double elapsed = (double)(now - last) / NPS;
71 <            System.out.printf("Arrays.sort   time:  %7.3f total %9.3f\n",
71 >            System.out.printf("Arrays.sort   time:  %7.3f total %9.3f\n",
72                                elapsed, total);
73              pool.invoke(new OrderChecker(null, a, 0, n, n));
74          }
# Line 86 | Line 86 | class CCBoxedLongSort {
86              long now = System.nanoTime();
87              double total = (double)(now - start) / NPS;
88              double elapsed = (double)(now - last) / NPS;
89 <            System.out.printf("Parallel sort time:  %7.3f total %9.3f\n",
89 >            System.out.printf("Parallel sort time:  %7.3f total %9.3f\n",
90                                elapsed, total);
91              pool.invoke(new OrderChecker(null, a, 0, n, n));
92          }
# Line 140 | Line 140 | class CCBoxedLongSort {
140                  int u = h + q;
141                  int lq = l + q, lh = l + h, lu = l + u;
142                  int nh = n - h, nu = n - u, hq = h - q;
143 <                Comerger fc =
143 >                Comerger fc =
144                      new Comerger(new Merger(s, w, a, l, h, lh, nh, l));
145 <                Comerger rc =
145 >                Comerger rc =
146                      new Comerger(new Merger(fc, a, w, lh, q, lu, nu, lh));
147 <                Comerger lc =
147 >                Comerger lc =
148                      new Comerger(new Merger(fc, a, w, l, q, lq, hq, l));
149                  Sorter su = new Sorter(rc, a, w, lu, nu);
150                  Sorter sh = new Sorter(rc, a, w, lh, q);
# Line 157 | Line 157 | class CCBoxedLongSort {
157              }
158              //            Arrays.sort(a, l, l+n);
159              quickSort(a, l, l+n-1);
160 <            s.tryComplete();
160 >            s.tryComplete();
161          }
162      }
163  
# Line 205 | Line 205 | class CCBoxedLongSort {
205                  rn = rh;
206                  ln = lh;
207              }
208 <            
208 >
209              int lFence = l + ln;
210              int rFence = r + rn;
211              for (Long t;;) {
# Line 213 | Line 213 | class CCBoxedLongSort {
213                      Long al = a[l], ar;
214                      if (r >= rFence ||
215                          al.longValue() <= (ar = a[r]).longValue()) {
216 <                        ++l; t = al;
217 <                    }
218 <                    else {
219 <                        ++r; t = ar;
216 >                        ++l; t = al;
217 >                    }
218 >                    else {
219 >                        ++r; t = ar;
220                      }
221                  }
222                  else if (r < rFence)
223                      t = a[r++];
224 <                else
224 >                else
225                      break;
226                  w[k++] = t;
227              }
# Line 243 | Line 243 | class CCBoxedLongSort {
243          final Long[] src;
244          final Long[] dst;
245          final int lo, hi, size;
246 <        RandomRepacker(CountedCompleter par, Long[] src, Long[] dst,
246 >        RandomRepacker(CountedCompleter par, Long[] src, Long[] dst,
247                         int lo, int hi, int size) {
248              super(par);
249              this.src = src; this.dst = dst;
250              this.lo = lo; this.hi = hi; this.size = size;
251          }
252 <        
252 >
253          public final void compute() {
254              Long[] s = src;
255              Long[] d = dst;
# Line 272 | Line 272 | class CCBoxedLongSort {
272          final int lo, hi, size;
273          OrderChecker(CountedCompleter par, Long[] a, int lo, int hi, int size) {
274              super(par);
275 <            this.array = a;
275 >            this.array = a;
276              this.lo = lo; this.hi = hi; this.size = size;
277          }
278  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines