Skip to content

Commit 9d34aaf

Browse files
committed
perf(pathfinder): fast-path exact directory searches
Signed-off-by: Kevin Turcios <turcioskevinr@gmail.com>
1 parent 0d22cb4 commit 9d34aaf

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

cuda_pathfinder/cuda/pathfinder/_utils/find_sub_dirs.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
1+
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

44
import functools
@@ -9,6 +9,14 @@
99

1010

1111
def find_sub_dirs_no_cache(parent_dirs: Sequence[str], sub_dirs: Sequence[str]) -> list[str]:
12+
if "*" not in sub_dirs:
13+
results = []
14+
for base in parent_dirs:
15+
candidate = os.path.join(base, *sub_dirs)
16+
if os.path.isdir(candidate):
17+
results.append(candidate)
18+
return results
19+
1220
results = []
1321
for base in parent_dirs:
1422
stack = [(base, 0)] # (current_path, index into sub_dirs)

0 commit comments

Comments
 (0)