Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fd starts slowly on systems with very many cores #1203

Closed
tavianator opened this issue Dec 6, 2022 · 3 comments · Fixed by #1412
Closed

fd starts slowly on systems with very many cores #1203

tavianator opened this issue Dec 6, 2022 · 3 comments · Fixed by #1412

Comments

@tavianator
Copy link
Collaborator

tavianator commented Dec 6, 2022

Originally posted by @pmarreck in #1131 (comment)

I use fd in some test suites and I noticed a slowdown. I investigated and I found that simply running fd with no arguments in an empty directory on /tmp (which is in-memory!) was taking 0.2 seconds. This is ridiculously slow on my machine (Ryzen Threadripper 3990x with 64 cores/128 threads running on NVMe). Multiplied by the number of times I was calling fd in my suite, this immediately explained why multiple seconds had been added at some point.

When I add the -j1 argument, as someone else indicated, the boot runtime of running fd alone drops to 0.01 seconds, which is 20x faster and far more reasonable an expectation.

I'm on NixOS unstable running on ZFS root.

@matu3ba & @tavianator , this is NOT a filesystem problem (IMHO). This looks like a heuristics bug regarding non-specification of the number of concurrent jobs to run (per the mandocs, not specifying it "uses heuristics")

At least I now know a workaround that works!

@pmarreck
Copy link

pmarreck commented Dec 6, 2022

(Just a note, I have a script at #1131 that anyone can run which shows the problem.)

@sharkdp
Copy link
Owner

sharkdp commented Jan 13, 2023

Can someone please provide some benchmark results? See #1131 (comment) as a starting point. Or https://github.com/sharkdp/fd-benchmarks for even more benchmarking scripts.

@paulirish
Copy link

some benchmarks:

enormous folder (chromium repo w/ 443K files)

image

empty folder

image

fyi nproc says 48, though i had seen 96 in lscpu, thus the above command. :) oops

json results for both: https://gist.github.com/paulirish/b94888c2e10f65702d8e09210c1584ad

@sharkdp sharkdp pinned this issue Oct 23, 2023
tmccombs added a commit to tmccombs/fd that referenced this issue Oct 26, 2023
Set a limit of how many threads fd will use by default. On hosts that
have a large number of cores, using additional threads has diminishing
returns, and having large numbers of threads increases the setup cost.
Thus we don't necessarily want to use the same number of threads as we
have cores.

Fixes: sharkdp#1203
tmccombs added a commit to tmccombs/fd that referenced this issue Oct 26, 2023
Set a limit of how many threads fd will use by default. On hosts that
have a large number of cores, using additional threads has diminishing
returns, and having large numbers of threads increases the setup cost.
Thus we don't necessarily want to use the same number of threads as we
have cores.

Fixes: sharkdp#1203
@tmccombs tmccombs unpinned this issue Jan 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants