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

(fs) Files.lines needs a better splitting implementation for stream source

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b71
    • Verification:
      Verified

      Backports

        Description

        The implementation of Files.lines uses the stream from BufferedReader.lines. The spliterator of that stream source is derived from an iterator and reports order but not size. This is the worst possible form of spliterator for parallel execution.

        The splitting of the stream source for Files.lines can be improved if the file can be mapped to a direct byte buffer that can be split at the mid-point from which the nearest line-deliminator can be found. Note this technique was implemented by Maurice Naftalin as an example in Chapter 5 of in his book Mastering Lambdas: Java Programming in a Multicore World (http://www.amazon.co.uk/Mastering-Lambdas-Programming-Multicore-World/dp/0071829628).

        Care needs to be taken to support multiple character sets.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                psandoz Paul Sandoz
                Reporter:
                psandoz Paul Sandoz
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: