On Tue, 19 Jan 2021 00:35:51 GMT, Claes Redestad <redes...@openjdk.org> wrote:
> This patch improves `UnixPath.encode` by reusing `JLA.getBytesNoRepl` (which > has fast-paths for common encoding) and avoiding a `toCharArray` call on the > input by refactoring the `normalizeNativePath` code to operate on `String`. > This might have a cost on files on Mac that need additional native > normalization. > > This removes another `ThreadLocal` and a source of `SoftReference`s. Together > with the UTF-8 fast-path my UTF-8 encoded file system see substantial > speed-ups in a trivial `new File(str).toPath()` microbenchmark. I think that this looks good ( I had a similar thought when looking through this code recently, for a separate issue ). ------------- Marked as reviewed by chegar (Reviewer). PR: https://git.openjdk.java.net/jdk/pull/2135