Skip to content

Commit

Permalink
Merge pull request #23 from luleyleo/full-threading
Browse files Browse the repository at this point in the history
Use all available cores for search
  • Loading branch information
luleyleo authored Nov 4, 2024
2 parents a0926f8 + e38f111 commit b5b749c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,18 @@ pub fn run(engine: SearchEngine, params: SearchParameters) {
}
let matcher = matcher.unwrap();

let threads = match std::thread::available_parallelism() {
Ok(cores) => cores.get(),
Err(_) => 2,
};

let walker = WalkBuilder::new(&params.base_directory)
.git_ignore(!params.flags.search_ignored)
.ignore(!params.flags.search_ignored)
.hidden(params.flags.search_hidden)
.follow_links(params.flags.follow_links)
.same_file_system(params.flags.same_filesystem)
.threads(threads)
.build_parallel();

let mut preprocessors: Vec<(_, extra::ExtraFn)> = Vec::new();
Expand Down

0 comments on commit b5b749c

Please sign in to comment.