Use 'fd' rather than 'find' in makefiles if available #865
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change: other enhancement
Impact: other
Description:
I frequently run Chipyard on a server with NFS-mounted hard drives (in other words, accessing files on disk is very slow), and any given
make
command usually takes upwards of 3 seconds before it even starts running. I've done a bit of profiling withstrace
, and unsurprisingly most ofmake
's time is spent on filesystem-related system calls (stat
,close
, etc). I didn't do extensive digging, but it looks to me like thelookup_srcs
command incommon.mk
is the source of most of these system calls. Since that is based aroundfind
, I figured that trying outfd
might present an opportunity for optimization. Here are some benchmarking results (done withhyperfine
):On that server with NFS-mounted spinning-platter hard drives:
On another server, but with an SSD:
On a MacBook Pro (which has an SSD):
So, all of these environments show improvements, but they're especially pronounced on a more disk-IO-limited system.
Considerations:
Since the
find
command being replaced prunes all paths containingtarget
, I figured I would just use thefd
default settings, which ignore hidden directories as well as paths in yourgitignore
settings, which includes thetarget
folders. Not sure if this is concerning to anyone, but I'm guessing that the source file dependencies don't live in hidden folders and aren't targeted bygitignore
files.Release Notes
Improve
make
speed by usingfd
to find files, if that command is available.