我读了番石榴文档:
ImmutableList<String> matchingLines = Files.readLines(
targetFile,
Charsets.UTF_8,
new LineProcessor<ImmutableList<String>>() {
final ImmutableList.Builder<String> builder = ImmutableList.builder();
@Override public boolean processLine(String line) {
if(pattern.matches(line)) builder.add(line);
return true;
}
@Override public ImmutableList<String> getResult() {
return builder.build();
}
});
于是我下载了源代码,发现Files.readLines没有使用MappedFile技术,
所以使用MappedFile技术性能较差。我想读取50M文件,如何提高性能