Skip to content

[BUG] performance regression in trivial searches between 8.4 and 8.5 persisting in 8.7 #1362

@moshelooks

Description

@moshelooks

Checks

  • I have read the troubleshooting section and still think this is a bug.

Describe the bug you encountered:

It takes nearly 10x longer to search an empty directory with fd 8.7 or 8.5 versus 8.4

> mkdir empty
> hyperfine -N 'fd-v8.4.0-x86_64-unknown-linux-gnu/fd . empty/' 'fd-v8.5.0-x86_64-unknown-linux-gnu/fd . empty/' 'fd-v8.7.0-x86_64-unknown-linux-gnu/fd . empty/'
Benchmark 1: fd-v8.4.0-x86_64-unknown-linux-gnu/fd . empty/
  Time (mean ± σ):       4.0 ms ±   0.4 ms    [User: 2.2 ms, System: 2.6 ms]
  Range (min … max):     3.3 ms …   5.9 ms    594 runs

Benchmark 2: fd-v8.5.0-x86_64-unknown-linux-gnu/fd . empty/
  Time (mean ± σ):      39.2 ms ±   2.3 ms    [User: 3.9 ms, System: 36.2 ms]
  Range (min … max):    36.8 ms …  56.7 ms    79 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet PC without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Benchmark 3: fd-v8.7.0-x86_64-unknown-linux-gnu/fd . empty/
  Time (mean ± σ):      38.4 ms ±   2.9 ms    [User: 3.5 ms, System: 35.9 ms]
  Range (min … max):    35.5 ms …  55.3 ms    81 runs

  Warning: Statistical outliers were detected. Consider re-running this benchmark on a quiet PC without any interferences from other programs. It might help to use the '--warmup' or '--prepare' options.

Summary
  'fd-v8.4.0-x86_64-unknown-linux-gnu/fd . empty/' ran
    9.68 ± 1.12 times faster than 'fd-v8.7.0-x86_64-unknown-linux-gnu/fd . empty/'
    9.88 ± 1.05 times faster than 'fd-v8.5.0-x86_64-unknown-linux-gnu/fd . empty/'

FWIW this is not an issue with startup time per se; running fd --version does not show any performance drop.

Using -F "" instead of . for the pattern show the same performance regression, if that's helpful to know.

I am happy to run any additional experiments that might be useful, but I'm afraid that my rust-fu is too weak to be of any use for deeper analysis or proposing a fix.

Describe what you expected to happen:

No response

What version of fd are you using?

fd 8.4.0 fd 8.5.0 fd 8.7.0

Which operating system / distribution are you on?

> uname -srm
Linux 5.15.0-76-generic x86_64
> lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.2 LTS
Release:	22.04
Codename:	jammy

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions