8208077: File.listRoots performance degradation

Reviewed-by: lancea, bpb
This commit is contained in:
Alan Bateman 2023-01-19 06:59:38 +00:00
parent 2e9cb4b1f6
commit 5b0af1a80b
2 changed files with 28 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -745,7 +745,7 @@ class WinNTFileSystem extends FileSystem {
.valueOf(new long[] {listRoots0()})
.stream()
.mapToObj(i -> new File((char)('A' + i) + ":" + slash))
.filter(f -> access(f.getPath()) && f.exists())
.filter(f -> access(f.getPath()))
.toArray(File[]::new);
}
private static native int listRoots0();