Skip to content

Commit

Permalink
add a benchmark against the previous version of cuniq
Browse files Browse the repository at this point in the history
  • Loading branch information
zkxs committed Feb 6, 2025
1 parent 5b91421 commit 4492f90
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions cuniq/benches/benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,22 @@ fn bench_cuniq_count_vs_shell(c: &mut Criterion) {
});
});

// cuniq input.txt
group.bench_function("cuniq-1.0.3", |bencher| {
bencher.iter(|| {
let cuniq = Command::new(r"C:\Users\runtime\.cargo\bin\cuniq-1.0.3.exe")
.arg("--no-stdin")
.arg("--memmap")
.arg(path_buf.as_os_str())
.stdout(Stdio::piped())
.spawn()
.unwrap();
let output = cuniq.wait_with_output().unwrap();
let result = std::str::from_utf8(&output.stdout).unwrap();
assert_eq!(result, &expected);
});
});

// cuniq input.txt
group.bench_function("cuniq", |bencher| {
bencher.iter(|| {
Expand Down Expand Up @@ -302,6 +318,23 @@ fn bench_cuniq_report_vs_shell(c: &mut Criterion) {
});
});

// cuniq -c input.txt
group.bench_function("cuniq-1.0.3", |bencher| {
bencher.iter(|| {
let cuniq = Command::new(r"C:\Users\runtime\.cargo\bin\cuniq-1.0.3.exe")
.arg("--no-stdin")
.arg("--memmap")
.arg("--report")
.arg(path_buf.as_os_str())
.stdout(Stdio::piped())
.spawn()
.unwrap();
let output = cuniq.wait_with_output().unwrap();
let result = std::str::from_utf8(&output.stdout).unwrap();
black_box(result);
});
});

// cuniq -c input.txt
group.bench_function("cuniq", |bencher| {
bencher.iter(|| {
Expand Down

0 comments on commit 4492f90

Please sign in to comment.