RFR: 8353923: (fs) Further improve performance of URI -> Path conversion (win)

Brian Burkhalter bpb at openjdk.org
Tue Apr 15 00:01:51 UTC 2025


On Mon, 14 Apr 2025 23:48:18 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

> If the path portion of a `URI` permits, then simply replace all `'\'` with `'/'` instead of completely parsing the path.

Benchmark testing of URI-to-Path conversion on Windows gives these results:

| URI | Throughput Change (%) |
| ---- | --------------------- |
| file:/C:/Users/bpb/git/foo/bar/classes/gus/dir/  | +63.96 |
| file:/C:/Users/bpb/git/foo/bar/classes/gus/dir   | +61.19 |
| file:/C:/Users/bpb/git/foo/bar/classes//gus/dir/ |  -4.19 |
| file:/C:/Users/bpb/git/foo/bar/classes//gus/dir  |  -2.21 |

For URIs having a path to which the optimization applies, the throughput increase is nearly two-thirds. For URIs which are not so amenable, there is a small throughput decrease of less than 5%. URIs which have a UNC path component are not affected.

So the question is whether a substantial throughput increase for susceptible absolute drive paths is worth a small but non-zero throughput decrease for other path components.

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

PR Comment: https://git.openjdk.org/jdk/pull/24638#issuecomment-2803357971


More information about the nio-dev mailing list