Skip to content

Commit 5bc200c

Browse files
authored
Merge pull request #10 from LyonSyonII/dev
Release v2.3.0: Multiple optimizations
2 parents e8556b1 + ddcbad9 commit 5bc200c

File tree

8 files changed

+185
-145
lines changed

8 files changed

+185
-145
lines changed

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [2.3.0]
6+
7+
### 🚀 Features
8+
9+
- Multiple small optimizations for up to 25% performance improvement
10+
- Parallelism is now at directory level instead of file level
11+
512
## [2.2.0]
613

714
### 🚀 Features

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repository = "https://github.com/LyonSyonII/hunt-rs"
66
keywords = ["algorithms", "filesystem"]
77
readme = "README.md"
88
license = "MIT"
9-
version = "2.2.0"
9+
version = "2.3.0"
1010
authors = ["Liam G <liam.garriga@tutanota.com>"]
1111
edition = "2021"
1212

@@ -38,6 +38,11 @@ strip = true
3838
debug = false
3939
panic = "abort"
4040

41+
[profile.profiling]
42+
inherits = "release"
43+
debug = true
44+
strip = false
45+
4146
# The profile that 'cargo dist' will build with
4247
[profile.dist]
4348
inherits = "release"

benchmarks/run

+52-42
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,59 @@
11
// https://github.com/lyonsyonii/run
22

3-
const build = cargo build --release
4-
const hunt = ../target/release/hunt
5-
const fd = fd --unrestricted --color=never
6-
7-
/// Search one file in ~/
8-
cmd 1() {
9-
$build;
10-
HUNT="$hunt --hidden --first --exact SomeFile $HOME";
11-
FD="$fd --max-results=1 SomeFile $HOME";
12-
# FIND="find $HOME -name SomeFile -print -quit";
13-
hyperfine -N --warmup 100 --ignore-failure \
14-
"$FD" \
15-
"$HUNT" \
16-
# "$FIND"
3+
cmd default() {
4+
echo "$doc"
175
}
186

19-
/// Search multiple files in ~/
20-
cmd 2() {
21-
$build;
22-
HUNT="$hunt --hidden SomeFile $HOME";
23-
FD="$fd SomeFile $HOME";
24-
# FIND="find $HOME -name SomeFile -print";
25-
hyperfine -N --warmup 1 --ignore-failure \
26-
"$FD" \
27-
"$HUNT" \
28-
# "$FIND"
29-
}
7+
sub bench {
8+
const build = cargo build --release
9+
const hunt = ../target/release/hunt
10+
const fd = fd --unrestricted --color=never
11+
12+
/// Search one file in ~/
13+
cmd 1() {
14+
$build;
15+
HUNT="$hunt --hidden --first --exact SomeFile $HOME";
16+
FD="$fd --max-results=1 SomeFile $HOME";
17+
# FIND="find $HOME -name SomeFile -print -quit";
18+
hyperfine -N --warmup 100 --ignore-failure \
19+
"$FD" \
20+
"$HUNT" \
21+
# "$FIND"
22+
}
3023

31-
/// Search multiple files in /
32-
cmd 3() {
33-
$build;
34-
HUNT="$hunt --hidden --exact SomeFile /";
35-
FD="$fd SomeFile /";
36-
hyperfine -N --warmup 1 --ignore-failure \
37-
"$FD" \
38-
"$HUNT" \
39-
}
24+
/// Search multiple files in ~/
25+
cmd 2() {
26+
$build;
27+
HUNT="../target/release/hunt-pariter --hidden SomeFile $HOME";
28+
HUNT2="$hunt --hidden SomeFile $HOME";
29+
FD="$fd SomeFile $HOME";
30+
# FIND="find $HOME -name SomeFile -print";
31+
hyperfine -N --warmup 1 --ignore-failure \
32+
"$FD" \
33+
"$HUNT" \
34+
"$HUNT2"
35+
# "$FIND"
36+
}
37+
38+
/// Search multiple files in /
39+
cmd 3() {
40+
$build;
41+
HUNT="../target/release/hunt-iter --hidden SomeFile /";
42+
HUNT2="$hunt --hidden SomeFile /";
43+
FD="$fd SomeFile /";
44+
hyperfine -N --warmup 1 --ignore-failure \
45+
"$FD" \
46+
"$HUNT" \
47+
"$HUNT2"
48+
}
4049

41-
/// Search all files in ~/
42-
cmd 4() {
43-
$build;
44-
HUNT="$hunt --hidden -ss $HOME";
45-
FD="$fd . $HOME";
46-
hyperfine -N --warmup 1 --ignore-failure \
47-
"$FD" \
48-
"$HUNT" \
50+
/// Search all files in ~/
51+
cmd 4() {
52+
$build;
53+
HUNT="$hunt --hidden -ss $HOME";
54+
FD="$fd . $HOME";
55+
hyperfine -N --warmup 1 --ignore-failure \
56+
"$FD" \
57+
"$HUNT"
58+
}
4959
}

src/main.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod print;
22
mod search;
3-
mod structs;
43
mod searchresult;
4+
mod structs;
55

66
#[cfg(not(any(test, miri)))]
77
#[global_allocator]
@@ -44,8 +44,7 @@ macro_rules! perf {
4444

4545
fn main() -> std::io::Result<()> {
4646
let search = structs::Cli::run();
47-
std::env::set_var("RUST_MIN_STACK", format!("{}", 1024 * 1024 * 1024));
48-
47+
4948
perf! {
5049
ctx = "search";
5150
let buffers = search.search();

src/print.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ pub fn print_with_highlight(
7070
} else {
7171
get_start_end(&search.ends)
7272
};
73-
73+
7474
use colored::Colorize;
7575

7676
// let ancestors = ancestors.display();

0 commit comments

Comments
 (0)