RFR: 8314569: (fs) Improve normalization of UnixPath for directories

Alan Bateman alanb at openjdk.org
Fri Aug 18 15:07:26 UTC 2023


On Fri, 18 Aug 2023 14:12:51 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> How often is the only normalization the removal of a trailing "/"? It seems quite likely.
> If that's the only normalization, then can the `normalize` call at line 94 could be replaced with a simple `substring(0, n-1)`.
> It would save the string buffer creation and copying.
> This is pretty carefully written code so it needs a thorough review.

The most common case is probably no duplicate or trailing slash, in which case this code won't be executed. The next most common is probably the trailing slash case, in which I think you have a good point, just need to be careful not to break the "/" case.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/15342#issuecomment-1684053615


More information about the nio-dev mailing list