Cache the results of is_exe_in_path.

Review Request #11823 — Created Sept. 27, 2021 and submitted — Latest diff uploaded

Information

RBTools
master

Reviewers

is_exe_in_path() may be called multiple times with the same executable
name, particularly when running from unit tests. Since an executable is
unlikely to appear or disappear within the lifetime of a process run in
a way that impacts RBTools, it's not worth re-scanning the whole path
every time we need to know if an executable is available.

This change adds caching behavior to is_exe_in_path(). Now, a repeated
call with the same executable name (with or without a .exe file
extension) will return the prior cached result.

All unit tests pass.

Diff Revision 1 (Latest)

Commits

First Last Summary ID Author
Cache the results of is_eze_in_path.
`is_exe_in_path()` may be called multiple times with the same executable name, particularly when running from unit tests. Since an executable is unlikely to appear or disappear within the lifetime of a process run in a way that impacts RBTools, it's not worth re-scanning the whole path every time we need to know if an executable is available. This change adds caching behavior to `is_exe_in_path()`. Now, a repeated call with the same executable name (with or without a `.exe` file extension) will return the prior cached result.
f90f6317d91f94af75fe1b11001d58d03b6986b9 Christian Hammond
rbtools/utils/filesystem.py
Loading...