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

Enable link-time optimization in release builds #343

Merged
merged 1 commit into from
Oct 14, 2018

Conversation

foxbenjaminfox
Copy link
Contributor

For release builds, it's probably worth enabling link-time optimization (LTO). The performance gains can be moderately significant: In the warm-cache-simple-pattern benchmark I observed an 8% improvement in the case of the [0-9]\.jpg$ pattern, and an 11% improvement in the case of the .*[0-9]\.jpg$ pattern. (Of course, much like the example benchmark in the README, this is one particular benchmark on one particular machine. I do wish there was a standardized set of files to run the benchmarks against, as I see was discussed (but not resolved) in issue #36.)

The main downside of LTO is that it makes the compile times longer. I feel that it's worth making that tradeoff in a tool like fd, for which (runtime) speed is one of its major selling points.

This gives a significant improvement to runtime performance, at the cost of somewhat worse compile times.
@sharkdp
Copy link
Owner

sharkdp commented Oct 12, 2018

Thank you very much for your contribution. I didn't know LTO could be enabled this easily. This is definitely promising. I'd love to make a few benchmarks myself before merging this (might take a few days).

Regarding standardized benchmarks, we should definitely work on this. We have been using the Linux Kernel Source in a few tickets, for example.

@sharkdp
Copy link
Owner

sharkdp commented Oct 14, 2018

I see consistent results (see below). Thank you so much!


Simple pattern:

Command Mean [ms] Min…Max [ms]
fd-master -HI '.*[0-9]\.jpg$' '/home/shark' 605.0 ± 2.6 600.3…609.9
fd-lto -HI '.*[0-9]\.jpg$' '/home/shark' 567.7 ± 4.1 560.0…575.7
fd-master '.*[0-9]\.jpg$' '/home/shark' 196.4 ± 3.0 193.3…205.4
fd-lto '.*[0-9]\.jpg$' '/home/shark' 177.9 ± 1.3 175.9…179.8

Filtering by type:

Command Mean [ms] Min…Max [ms]
find '/home/shark' -type l 1869.4 ± 6.7 1862.7…1882.9
fd-master -HI '' '/home/shark' --type l 567.4 ± 2.8 563.4…572.1
fd-lto -HI '' '/home/shark' --type l 539.2 ± 2.6 535.0…543.4

Filtering by extension:

Command Mean [ms] Min…Max [ms]
find '/home/shark' -iname '*.jpg' 2344.4 ± 9.5 2331.3…2360.2
fd-master -HI --extension 'jpg' '' '/home/shark' 602.3 ± 1.9 599.5…604.4
fd-lto -HI --extension 'jpg' '' '/home/shark' 567.3 ± 4.0 563.1…574.8

@sharkdp sharkdp merged commit b98f078 into sharkdp:master Oct 14, 2018
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 this pull request may close these issues.

2 participants