RFR: 8259947: (fs) Optimize UnixPath.encode implementation [v4]
Aleksey Shipilev
shade at openjdk.java.net
Wed Jan 20 15:11:20 UTC 2021
On Wed, 20 Jan 2021 15:08:22 GMT, Claes Redestad <redestad at 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.
>
> Claes Redestad has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
>
> - Merge branch 'master' into unix_encode
> - Move FileOpen.ToPath micros into top class
> - Move JLA to top, add imports
> - Fold ToPath into FileOpen, add root benchmarks to keep mix comparable
> - Add micro. To properly examine cost of toPath() needs a new File due caching - use FileOpen as a baseline
> - Optimize UnixPath.encode
Marked as reviewed by shade (Reviewer).
-------------
PR: https://git.openjdk.java.net/jdk/pull/2135
More information about the core-libs-dev
mailing list