RFR: 8368633: (fs) Path.toRealPath(NOFOLLOW_LINKS) very slow on macOS [v2]
Brian Burkhalter
bpb at openjdk.org
Mon Oct 13 22:33:26 UTC 2025
On Mon, 13 Oct 2025 16:06:39 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> src/java.base/unix/classes/sun/nio/fs/UnixPath.java line 959:
>>
>>> 957: try (DirectoryStream<Path> entries = new UnixDirectoryStream(path, dp, filter)) {
>>> 958: // compare path bytes until a match is found
>>> 959: List<Path> notMatched = new ArrayList<Path>();
>>
>> Can you try a version that doesn't collect but instead opens a new UnixDirectoryStream for the second/slow scan? I'm asking because the directory have many thousands of entries so there is a risk of OOME here.
>
>> Can you try a version that doesn't collect but instead opens a new UnixDirectoryStream for the second/slow scan?
>
> I was not sure of that either. I'll change it.
So changed in 88b3341.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27709#discussion_r2427436218
More information about the nio-dev
mailing list