Skip to content

Commit 1ed8530

Browse files
committed
Switch to using linux as our search repo for fd
Previously, we used our alloy src dir for this purpose. We did this because it was a large directory with lots of different files to stress fd, but on balance this was not a great idea for a few reasons. 1. Unlike src/alloy, it makes fd benchmarks more easily reproducable because the contents do not change between alloy versions. 2. As above, there are no longer issues with temporary build files that will differ between experiments E.g. docker and baremetal builds where build contexts do not transfer over build artefacts. 3. Consistency with ripgrep, which also uses linux 4. rebench (our benchmark runner) checks for words like 'error' in stdout to determine if the benchmark failed. In some fd benchmarks, the contents of the entire directory is written to stdout, and sometimes build artefacts in that directory include 'error' in their filename. This can cause occasional false-positives where rebench erroneously marks a valid benchmark run as having failed. This is less than ideal, but unfortunately we can't easily tune this behaviour, so using Linux allows us to sidestep it completely.
1 parent f64e025 commit 1ed8530

File tree

5 files changed

+61
-39
lines changed

5 files changed

+61
-39
lines changed

artefacts.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,14 @@ def build(self):
199199
),
200200
)
201201

202+
LINUX = Repo(
203+
name="linux",
204+
url="https://github.com/BurntSushi/linux",
205+
version="master",
206+
shallow_clone=True,
207+
post_checkout=(("make", "defconfig"), ("make", "-j100")),
208+
)
209+
202210

203211
class Alloy(Artefact):
204212
DEFAULT_FLAGS: ClassVar[Dict[str, bool]] = {

benchmarks.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,27 @@ def __lt__(self, other):
3535
FD = (
3636
Benchmark(
3737
name="no-pattern",
38-
extra_args=f"--hidden --no-ignore {artefacts.ALLOY.src}",
38+
extra_args=f"--hidden --no-ignore . '{artefacts.LINUX.src}'",
3939
),
4040
Benchmark(
41-
name="simple-pattern", extra_args=f"'.*[0-9]\\.jpg$' . '{artefacts.ALLOY.src}'"
41+
name="simple-pattern", extra_args=f"'.*[0-9]\\.jpg$' . '{artefacts.LINUX.src}'"
4242
),
4343
Benchmark(
4444
name="simple-pattern-HI",
45-
extra_args=f"-HI '.*[0-9]\\.jpg$' . '{artefacts.ALLOY.src}'",
45+
extra_args=f"-HI '.*[0-9]\\.jpg$' . '{artefacts.LINUX.src}'",
4646
),
4747
Benchmark(
4848
name="file-extension",
49-
extra_args=f"-HI --extension jpg . '{artefacts.ALLOY.src}'",
49+
extra_args=f"-HI --extension jpg . '{artefacts.LINUX.src}'",
5050
),
51-
Benchmark(name="file-type", extra_args=f"-HI --type l . '{artefacts.ALLOY.src}'"),
51+
Benchmark(name="file-type", extra_args=f"-HI --type l . '{artefacts.LINUX.src}'"),
5252
Benchmark(
5353
name="command-execution",
54-
extra_args=f"'ab' . '{artefacts.ALLOY.src}' --exec echo",
54+
extra_args=f"'ab' . '{artefacts.LINUX.src}' --exec echo",
5555
),
5656
Benchmark(
5757
name="command-execution-large-output",
58-
extra_args=f"-tf 'ab' . '{artefacts.ALLOY.src}' --exec echo",
58+
extra_args=f"-tf 'ab' . '{artefacts.LINUX.src}' --exec echo",
5959
),
6060
)
6161

build.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -530,20 +530,12 @@ class RipGrep(BenchmarkSuite):
530530
version="de4baa10024f2cb62d438596274b9b710e01c59b",
531531
)
532532

533-
LINUX = Repo(
534-
name="linux",
535-
url="https://github.com/BurntSushi/linux",
536-
version="master",
537-
shallow_clone=True,
538-
post_checkout=(("make", "defconfig"), ("make", "-j100")),
539-
)
540-
541533
@property
542534
def cmd_args(self):
543535
return f"-j1 $(cat {str(Path('aux/ripgrep_args').resolve())}/%(benchmark)s) {str(RipGrep.LINUX.src)}"
544536

545537
def build(self, c, target_dir, install_dir, bench_cfg_bin, profile, env):
546-
self.LINUX.fetch()
538+
artefacts.LINUX.fetch()
547539
self.RIPGREP.fetch()
548540

549541
if not (self.LINUX.src / ".config").exists():
@@ -657,7 +649,10 @@ def cmd_args(self):
657649

658650
def build(self, c, target_dir, install_dir, bench_cfg_bin, profile, env):
659651
self.FD.fetch()
660-
ALLOY.repo.fetch()
652+
LINUX.fetch()
653+
654+
patch_repo(c, self.FD.src, PATCH_DIR / f"fd.{profile}.diff")
655+
661656
cargo_build(
662657
c,
663658
self.FD.src,

patch/fd.arc.diff

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
diff --git a/src/main.rs b/src/main.rs
2-
index bef4120..4d6d034 100644
2+
index d275b2a..4228a13 100644
33
--- a/src/main.rs
44
+++ b/src/main.rs
5-
@@ -1,3 +1,4 @@
6-
+#![feature(gc)]
7-
mod cli;
8-
mod config;
9-
mod dir_entry;
10-
@@ -46,7 +47,8 @@ use crate::regex_helper::{pattern_has_uppercase_char, pattern_matches_strings_wi
11-
feature = "use-jemalloc"
12-
))]
13-
#[global_allocator]
14-
-static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
15-
+static ALLOC: std::gc::GcAllocator = std::gc::GcAllocator;
16-
+
5+
@@ -35,21 +35,6 @@ use crate::filter::OwnerFilter;
6+
use crate::filter::TimeFilter;
7+
use crate::regex_helper::{pattern_has_uppercase_char, pattern_matches_strings_with_leading_dot};
178

9+
-// We use jemalloc for performance reasons, see https://github.com/sharkdp/fd/pull/481
10+
-// FIXME: re-enable jemalloc on macOS, see comment in Cargo.toml file for more infos
11+
-#[cfg(all(
12+
- not(windows),
13+
- not(target_os = "android"),
14+
- not(target_os = "macos"),
15+
- not(target_os = "freebsd"),
16+
- not(target_os = "openbsd"),
17+
- not(all(target_env = "musl", target_pointer_width = "32")),
18+
- not(target_arch = "riscv64"),
19+
- feature = "use-jemalloc"
20+
-))]
21+
-#[global_allocator]
22+
-static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
23+
-
1824
// vivid --color-mode 8-bit generate molokai
1925
const DEFAULT_LS_COLORS: &str = "
26+
ow=0:or=0;38;5;16;48;5;203:no=0:ex=1;38;5;203:cd=0;38;5;203;48;5;236:mi=0;38;5;16;48;5;203:*~=0;38;5;243:st=0:pi=0;38;5;16;48;5;81:fi=0:di=0;38;5;81:so=0;38;5;16;48;5;203:bd=0;38;5;81;48;5;236:tw=0:ln=0;38;5;203:*.m=0;38;5;48:*.o=0;38;5;243:*.z=4;38;5;203:*.a=1;38;5;203:*.r=0;38;5;48:*.c=0;38;5;48:*.d=0;38;5;48:*.t=0;38;5;48:*.h=0;38;5;48:*.p=0;38;5;48:*.cc=0;38;5;48:*.ll=0;38;5;48:*.jl=0;38;5;48:*css=0;38;5;48:*.md=0;38;5;185:*.gz=4;38;5;203:*.nb=0;38;5;48:*.mn=0;38;5;48:*.go=0;38;5;48:*.xz=4;38;5;203:*.so=1;38;5;203:*.rb=0;38;5;48:*.pm=0;38;5;48:*.bc=0;38;5;243:*.py=0;38;5;48:*.as=0;38;5;48:*.pl=0;38;5;48:*.rs=0;38;5;48:*.sh=0;38;5;48:*.7z=4;38;5;203:*.ps=0;38;5;186:*.cs=0;38;5;48:*.el=0;38;5;48:*.rm=0;38;5;208:*.hs=0;38;5;48:*.td=0;38;5;48:*.ui=0;38;5;149:*.ex=0;38;5;48:*.js=0;38;5;48:*.cp=0;38;5;48:*.cr=0;38;5;48:*.la=0;38;5;243:*.kt=0;38;5;48:*.ml=0;38;5;48:*.vb=0;38;5;48:*.gv=0;38;5;48:*.lo=0;38;5;243:*.hi=0;38;5;243:*.ts=0;38;5;48:*.ko=1;38;5;203:*.hh=0;38;5;48:*.pp=0;38;5;48:*.di=0;38;5;48:*.bz=4;38;5;203:*.fs=0;38;5;48:*.png=0;38;5;208:*.zsh=0;38;5;48:*.mpg=0;38;5;208:*.pid=0;38;5;243:*.xmp=0;38;5;149:*.iso=4;38;5;203:*.m4v=0;38;5;208:*.dot=0;38;5;48:*.ods=0;38;5;186:*.inc=0;38;5;48:*.sxw=0;38;5;186:*.aif=0;38;5;208:*.git=0;38;5;243:*.gvy=0;38;5;48:*.tbz=4;38;5;203:*.log=0;38;5;243:*.txt=0;38;5;185:*.ico=0;38;5;208:*.csx=0;38;5;48:*.vob=0;38;5;208:*.pgm=0;38;5;208:*.pps=0;38;5;186:*.ics=0;38;5;186:*.img=4;38;5;203:*.fon=0;38;5;208:*.hpp=0;38;5;48:*.bsh=0;38;5;48:*.sql=0;38;5;48:*TODO=1:*.php=0;38;5;48:*.pkg=4;38;5;203:*.ps1=0;38;5;48:*.csv=0;38;5;185:*.ilg=0;38;5;243:*.ini=0;38;5;149:*.pyc=0;38;5;243:*.psd=0;38;5;208:*.htc=0;38;5;48:*.swp=0;38;5;243:*.mli=0;38;5;48:*hgrc=0;38;5;149:*.bst=0;38;5;149:*.ipp=0;38;5;48:*.fsi=0;38;5;48:*.tcl=0;38;5;48:*.exs=0;38;5;48:*.out=0;38;5;243:*.jar=4;38;5;203:*.xls=0;38;5;186:*.ppm=0;38;5;208:*.apk=4;38;5;203:*.aux=0;38;5;243:*.rpm=4;38;5;203:*.dll=1;38;5;203:*.eps=0;38;5;208:*.exe=1;38;5;203:*.doc=0;38;5;186:*.wma=0;38;5;208:*.deb=4;38;5;203:*.pod=0;38;5;48:*.ind=0;38;5;243:*.nix=0;38;5;149:*.lua=0;38;5;48:*.epp=0;38;5;48:*.dpr=0;38;5;48:*.htm=0;38;5;185:*.ogg=0;38;5;208:*.bin=4;38;5;203:*.otf=0;38;5;208:*.yml=0;38;5;149:*.pro=0;38;5;149:*.cxx=0;38;5;48:*.tex=0;38;5;48:*.fnt=0;38;5;208:*.erl=0;38;5;48:*.sty=0;38;5;243:*.bag=4;38;5;203:*.rst=0;38;5;185:*.pdf=0;38;5;186:*.pbm=0;38;5;208:*.xcf=0;38;5;208:*.clj=0;38;5;48:*.gif=0;38;5;208:*.rar=4;38;5;203:*.elm=0;38;5;48:*.bib=0;38;5;149:*.tsx=0;38;5;48:*.dmg=4;38;5;203:*.tmp=0;38;5;243:*.bcf=0;38;5;243:*.mkv=0;38;5;208:*.svg=0;38;5;208:*.cpp=0;38;5;48:*.vim=0;38;5;48:*.bmp=0;38;5;208:*.ltx=0;38;5;48:*.fls=0;38;5;243:*.flv=0;38;5;208:*.wav=0;38;5;208:*.m4a=0;38;5;208:*.mid=0;38;5;208:*.hxx=0;38;5;48:*.pas=0;38;5;48:*.wmv=0;38;5;208:*.tif=0;38;5;208:*.kex=0;38;5;186:*.mp4=0;38;5;208:*.bak=0;38;5;243:*.xlr=0;38;5;186:*.dox=0;38;5;149:*.swf=0;38;5;208:*.tar=4;38;5;203:*.tgz=4;38;5;203:*.cfg=0;38;5;149:*.xml=0;

patch/fd.gc.diff

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
11
diff --git a/src/main.rs b/src/main.rs
2-
index bef4120..4d6d034 100644
2+
index d275b2a..9b98ac9 100644
33
--- a/src/main.rs
44
+++ b/src/main.rs
55
@@ -1,3 +1,4 @@
66
+#![feature(gc)]
77
mod cli;
88
mod config;
99
mod dir_entry;
10-
@@ -46,7 +47,8 @@ use crate::regex_helper::{pattern_has_uppercase_char, pattern_matches_strings_wi
11-
feature = "use-jemalloc"
12-
))]
13-
#[global_allocator]
14-
-static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
15-
+static ALLOC: std::gc::GcAllocator = std::gc::GcAllocator;
16-
+
10+
@@ -35,21 +36,6 @@ use crate::filter::OwnerFilter;
11+
use crate::filter::TimeFilter;
12+
use crate::regex_helper::{pattern_has_uppercase_char, pattern_matches_strings_with_leading_dot};
1713

14+
-// We use jemalloc for performance reasons, see https://github.com/sharkdp/fd/pull/481
15+
-// FIXME: re-enable jemalloc on macOS, see comment in Cargo.toml file for more infos
16+
-#[cfg(all(
17+
- not(windows),
18+
- not(target_os = "android"),
19+
- not(target_os = "macos"),
20+
- not(target_os = "freebsd"),
21+
- not(target_os = "openbsd"),
22+
- not(all(target_env = "musl", target_pointer_width = "32")),
23+
- not(target_arch = "riscv64"),
24+
- feature = "use-jemalloc"
25+
-))]
26+
-#[global_allocator]
27+
-static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
28+
-
1829
// vivid --color-mode 8-bit generate molokai
1930
const DEFAULT_LS_COLORS: &str = "
31+
ow=0:or=0;38;5;16;48;5;203:no=0:ex=1;38;5;203:cd=0;38;5;203;48;5;236:mi=0;38;5;16;48;5;203:*~=0;38;5;243:st=0:pi=0;38;5;16;48;5;81:fi=0:di=0;38;5;81:so=0;38;5;16;48;5;203:bd=0;38;5;81;48;5;236:tw=0:ln=0;38;5;203:*.m=0;38;5;48:*.o=0;38;5;243:*.z=4;38;5;203:*.a=1;38;5;203:*.r=0;38;5;48:*.c=0;38;5;48:*.d=0;38;5;48:*.t=0;38;5;48:*.h=0;38;5;48:*.p=0;38;5;48:*.cc=0;38;5;48:*.ll=0;38;5;48:*.jl=0;38;5;48:*css=0;38;5;48:*.md=0;38;5;185:*.gz=4;38;5;203:*.nb=0;38;5;48:*.mn=0;38;5;48:*.go=0;38;5;48:*.xz=4;38;5;203:*.so=1;38;5;203:*.rb=0;38;5;48:*.pm=0;38;5;48:*.bc=0;38;5;243:*.py=0;38;5;48:*.as=0;38;5;48:*.pl=0;38;5;48:*.rs=0;38;5;48:*.sh=0;38;5;48:*.7z=4;38;5;203:*.ps=0;38;5;186:*.cs=0;38;5;48:*.el=0;38;5;48:*.rm=0;38;5;208:*.hs=0;38;5;48:*.td=0;38;5;48:*.ui=0;38;5;149:*.ex=0;38;5;48:*.js=0;38;5;48:*.cp=0;38;5;48:*.cr=0;38;5;48:*.la=0;38;5;243:*.kt=0;38;5;48:*.ml=0;38;5;48:*.vb=0;38;5;48:*.gv=0;38;5;48:*.lo=0;38;5;243:*.hi=0;38;5;243:*.ts=0;38;5;48:*.ko=1;38;5;203:*.hh=0;38;5;48:*.pp=0;38;5;48:*.di=0;38;5;48:*.bz=4;38;5;203:*.fs=0;38;5;48:*.png=0;38;5;208:*.zsh=0;38;5;48:*.mpg=0;38;5;208:*.pid=0;38;5;243:*.xmp=0;38;5;149:*.iso=4;38;5;203:*.m4v=0;38;5;208:*.dot=0;38;5;48:*.ods=0;38;5;186:*.inc=0;38;5;48:*.sxw=0;38;5;186:*.aif=0;38;5;208:*.git=0;38;5;243:*.gvy=0;38;5;48:*.tbz=4;38;5;203:*.log=0;38;5;243:*.txt=0;38;5;185:*.ico=0;38;5;208:*.csx=0;38;5;48:*.vob=0;38;5;208:*.pgm=0;38;5;208:*.pps=0;38;5;186:*.ics=0;38;5;186:*.img=4;38;5;203:*.fon=0;38;5;208:*.hpp=0;38;5;48:*.bsh=0;38;5;48:*.sql=0;38;5;48:*TODO=1:*.php=0;38;5;48:*.pkg=4;38;5;203:*.ps1=0;38;5;48:*.csv=0;38;5;185:*.ilg=0;38;5;243:*.ini=0;38;5;149:*.pyc=0;38;5;243:*.psd=0;38;5;208:*.htc=0;38;5;48:*.swp=0;38;5;243:*.mli=0;38;5;48:*hgrc=0;38;5;149:*.bst=0;38;5;149:*.ipp=0;38;5;48:*.fsi=0;38;5;48:*.tcl=0;38;5;48:*.exs=0;38;5;48:*.out=0;38;5;243:*.jar=4;38;5;203:*.xls=0;38;5;186:*.ppm=0;38;5;208:*.apk=4;38;5;203:*.aux=0;38;5;243:*.rpm=4;38;5;203:*.dll=1;38;5;203:*.eps=0;38;5;208:*.exe=1;38;5;203:*.doc=0;38;5;186:*.wma=0;38;5;208:*.deb=4;38;5;203:*.pod=0;38;5;48:*.ind=0;38;5;243:*.nix=0;38;5;149:*.lua=0;38;5;48:*.epp=0;38;5;48:*.dpr=0;38;5;48:*.htm=0;38;5;185:*.ogg=0;38;5;208:*.bin=4;38;5;203:*.otf=0;38;5;208:*.yml=0;38;5;149:*.pro=0;38;5;149:*.cxx=0;38;5;48:*.tex=0;38;5;48:*.fnt=0;38;5;208:*.erl=0;38;5;48:*.sty=0;38;5;243:*.bag=4;38;5;203:*.rst=0;38;5;185:*.pdf=0;38;5;186:*.pbm=0;38;5;208:*.xcf=0;38;5;208:*.clj=0;38;5;48:*.gif=0;38;5;208:*.rar=4;38;5;203:*.elm=0;38;5;48:*.bib=0;38;5;149:*.tsx=0;38;5;48:*.dmg=4;38;5;203:*.tmp=0;38;5;243:*.bcf=0;38;5;243:*.mkv=0;38;5;208:*.svg=0;38;5;208:*.cpp=0;38;5;48:*.vim=0;38;5;48:*.bmp=0;38;5;208:*.ltx=0;38;5;48:*.fls=0;38;5;243:*.flv=0;38;5;208:*.wav=0;38;5;208:*.m4a=0;38;5;208:*.mid=0;38;5;208:*.hxx=0;38;5;48:*.pas=0;38;5;48:*.wmv=0;38;5;208:*.tif=0;38;5;208:*.kex=0;38;5;186:*.mp4=0;38;5;208:*.bak=0;38;5;243:*.xlr=0;38;5;186:*.dox=0;38;5;149:*.swf=0;38;5;208:*.tar=4;38;5;203:*.tgz=4;38;5;203:*.cfg=0;38;5;149:*.xml=0;
2032
diff --git a/src/walk.rs b/src/walk.rs
21-
index c81d2a4..4da5cfc 100644
33+
index 0991e1c..ab21095 100644
2234
--- a/src/walk.rs
2335
+++ b/src/walk.rs
2436
@@ -4,9 +4,10 @@ use std::io::{self, Write};

0 commit comments

Comments
 (0)