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

Comparing jsr166/src/test/extra166y/SortDemo.java (file contents):
Revision 1.1 by dl, Sun Nov 1 22:00:35 2009 UTC vs.
Revision 1.6 by jsr166, Tue Mar 15 19:47:04 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   import jsr166y.*;
# Line 14 | Line 14 | class SortDemo {
14      static final long NPS = (1000L * 1000 * 1000);
15  
16      public static void main (String[] args) throws Exception {
17 <        int n = 1 << 20;
17 >        int n = 1 << 22;
18          int sreps = 4;
19          int reps = 20;
20          Long[] a = new Long[n];
# Line 39 | Line 39 | class SortDemo {
39          System.out.println(fjpool);
40          fjpool.shutdown();
41      }
42 <    
42 >
43      static void seqSort(Long[] a) {
44          long last = System.nanoTime();
45          java.util.Arrays.sort(a);
# Line 53 | Line 53 | class SortDemo {
53          double elapsed = (double)(System.nanoTime() - last) / NPS;
54          System.out.printf("ParallelArray.sort time:     %7.3f\n", elapsed);
55      }
56 <    
57 <    static void checkSorted (Long[] a)  {
56 >
57 >    static void checkSorted(Long[] a) {
58          int n = a.length;
59          for (int i = 0; i < n - 1; i++) {
60              if (a[i].compareTo(a[i+1]) > 0) {
# Line 62 | Line 62 | class SortDemo {
62              }
63          }
64      }
65 <    
65 >
66      static final class RandomLongGenerator implements Ops.Generator<Long> {
67          public Long op() {
68              return new Long(ThreadLocalRandom.current().nextLong());

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines