RFR: 8314569: (fs) Improve normalization of UnixPath for directories(fs) Improve normalization of UnixPath for input with trailing slashes [v2]
Alan Bateman
alanb at openjdk.org
Tue Aug 29 07:43:11 UTC 2023
On Mon, 21 Aug 2023 10:50:47 GMT, Sergey Tsypanov <stsypanov at openjdk.org> wrote:
>> Sergey Tsypanov 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 three additional commits since the last revision:
>>
>> - Merge branch 'master' into unixpath-check-nn
>> - Further improvement
>> - Improve UnixPath normalization
>
> Updated the PR. Checked cases for normal path (requires no normalization) and root:
>
> @BenchmarkMode(Mode.AverageTime)
> @OutputTimeUnit(TimeUnit.NANOSECONDS)
> @Warmup(time = 2, iterations = 5)
> @Measurement(time = 2, iterations = 5)
> @Fork(value = 4, jvmArgs = "-Xmx1g")
> public class FileToPathBenchmark {
>
> @Benchmark
> public Path toDirectoryPath(Data data) {
> return FileSystems.getDefault().getPath(data.directoryPath);
> }
>
>
> @Benchmark
> public Path toDirectoryPathDoubleSlash(Data data) {
> return FileSystems.getDefault().getPath(data.directoryPathWithDoubleSlash);
> }
>
> @Benchmark
> public Path toNormalPath(Data data) {
> return FileSystems.getDefault().getPath(data.normalPath);
> }
>
> @Benchmark
> public Path toRootPath(Data data) {
> return FileSystems.getDefault().getPath(data.rootPath);
> }
>
> @State(Scope.Thread)
> public static class Data {
> private final String rootPath = "/";
> private final String normalPath = "/tmp/tmp/tmp";
> private final String directoryPath = "/tmp/tmp/tmp/";
> private final String directoryPathWithDoubleSlash = "/tmp//tmp/tmp/";
> }
> }
>
> Results:
>
> baseline
>
> Benchmark Mode Cnt Score Error Units
> FileToPathBenchmark.toDirectoryPath avgt 20 44.993 ± 1.676 ns/op
> FileToPathBenchmark.toDirectoryPath:·gc.alloc.rate avgt 20 3732.628 ± 137.446 MB/sec
> FileToPathBenchmark.toDirectoryPath:·gc.alloc.rate.norm avgt 20 176.000 ± 0.001 B/op
> FileToPathBenchmark.toDirectoryPath:·gc.count avgt 20 234.000 counts
> FileToPathBenchmark.toDirectoryPath:·gc.time avgt 20 1129.000 ms
> FileToPathBenchmark.toDirectoryPathDoubleSlash avgt 20 58.963 ± 1.737 ns/op
> FileToPathBenchmark.toDirectoryPathDoubleSlash:·gc.alloc.rate avgt 20 2717.169 ± 78.664 MB/sec
> FileToPathBenchmark.toDirectoryPathDoubleSlash:·gc.alloc.rate.norm avgt 20 168.000 ± 0.001 B/op
> FileToPathBenchmark.toDirectoryPathDoubleSlash:·gc.count avgt 20 190.000 counts
> FileToPathBenchmark.toDirectoryPathDoubleSlash:·gc.time avgt 20 755.000 ms
> FileToPathBenchmark.toNormalPath avgt 20 14.017 ± 0.367 ns/op
> FileToPathBenchmark.toNormalPath:·gc.alloc....
@stsypanov The title on the PR is currently:
"(fs) Improve normalization of UnixPath for directories(fs) Improve normalization of UnixPath for input with trailing slashes #15342"
Something got fat fingered somewhere. Can you fix it to match the JBS issue "(fs) Improve normalization of UnixPath for input with trailing slashes" and then we can sponsor?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/15342#issuecomment-1696931696
More information about the nio-dev
mailing list