RFR: 8368633: (fs) Path.toRealPath(NOFOLLOW_LINKS) very slow on macOS [v2]
Alan Bateman
alanb at openjdk.org
Sat Oct 11 06:44:02 UTC 2025
On Fri, 10 Oct 2025 23:02:24 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Try to avoid checking file keys for all entries by first attempting `Path.compareTo` and `String.equalsIgnoreCase`.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8368633: Compare byte representations first then file keys; add micro
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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27709#discussion_r2422537969
More information about the nio-dev
mailing list