-
Enhancement
-
Resolution: Fixed
-
P4
-
None
-
b71
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8135944 | emb-9 | Paul Sandoz | P4 | Resolved | Fixed | team |
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.
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.
- backported by
-
JDK-8135944 (fs) Files.lines needs a better splitting implementation for stream source
-
- Resolved
-
- relates to
-
JDK-8129776 The optimized Stream returned from Files.lines should unmap the mapped byte buffer (if created) when closed
-
- Resolved
-
-
JDK-8132539 (fs) Files.lines(path).collect() returns wrong value in JDK 9 with certain files
-
- Closed
-