How to read all lines of a file in parallel in Java 8
问题 I want to read all lines of a 1 GB large file as fast as possible into a Stream<String> . Currently I'm using Files(path).lines() for that. After parsing the file, I'm doing some computations ( map() / filter() ) At first I thought this is already done in parallel, but it seems I'm wrong: When reading the file as it is, it takes about 50 seconds on my dual CPU laptop. However, if I split the file using bash commands and then process them in parallel, it only takes about 30 seconds. I tried