Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8003981

Support Parallel Array Sorting - JEP 103

    XMLWordPrintable

Details

    • Enhancement
    • Status: Closed
    • P2
    • Resolution: Fixed
    • None
    • 8
    • core-libs
    • b71

    Description

      see http://openjdk.java.net/jeps/103 for full details

      Summary

      Add additional utility methods to java.util.Arrays that use the JSR 166 Fork/Join parallelism common pool to provide sorting of arrays in parallel.

      Description

      Current sorting implementations provided by the Java Collections Framework (Collections.sort and Arrays.sort) all perform the sorting operation sequentially in the calling thread. This enhancement will offer the same set of sorting operations currently provided by the Arrays class, but with a parallel implementation that utilizes the Fork/Join framework. These new API’s are still synchronous with regard to the calling thread as it will not proceed past the sorting operation until the parallel sort is complete.

      The actual sorting API this proposal adds will leverage the ForkJoinPool commonPool (default Fork/Join pool being defined by JEP 155).

      public class Arrays {
        ...
        public static void parallelSort(byte[] a) { ... }
        public static void parallelSort(byte[] a, int fromIndex, int toIndex)
        public static void parallelSort(short[] a) { ... }
        public static void parallelSort(short[] a, int fromIndex, int toIndex)
          {...}

        ...
      }

      Sort methods are defined for all primitive array types except boolean, plus Comparable object types, plus arbitrary Object types using a supplied Comparator. The sorting algorithm is that used in Doug Lea’s ParallelArray implementation and requires a working space the same size as the array to be sorted (this is the whole array, not just the portion to be sorted).

      Attachments

        Issue Links

          Activity

            People

              chegar Chris Hegarty
              chegar Chris Hegarty
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: