Skip to content

Commit 21abcbe

Browse files
committed
Disables non-criterion benchmarks
1 parent 5b599a4 commit 21abcbe

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

Cargo.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ rustc-hash = "2"
2626
rstest = "0.25.0"
2727
criterion = "0.5"
2828

29+
[lib]
30+
bench = false
31+
32+
[[bin]]
33+
name = "pnp"
34+
path = "src/main.rs"
35+
bench = false
36+
2937
[[bench]]
3038
name = "vpath_bench"
3139
harness = false

benches/vpath_bench.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use criterion::{black_box, criterion_group, criterion_main, Criterion};
22
use std::path::Path;
3+
use std::time::Duration;
34
use pnp::fs::VPath;
45

56
fn bench_vpath_native(c: &mut Criterion) {
@@ -9,7 +10,7 @@ fn bench_vpath_native(c: &mut Criterion) {
910
"/home/user/project/src/main.rs",
1011
"/very/long/path/with/many/segments/that/could/be/expensive/to/parse",
1112
];
12-
13+
1314
c.bench_function("vpath_native", |b| {
1415
b.iter(|| {
1516
for path in &paths {
@@ -26,7 +27,7 @@ fn bench_vpath_virtual(c: &mut Criterion) {
2627
"/deep/path/__virtual__/ghi789/1/node_modules/nested/package/src/file.ts",
2728
"/complex/__virtual__/jkl012/3/node_modules/very-long-package-name/dist/bundle.js",
2829
];
29-
30+
3031
c.bench_function("vpath_virtual", |b| {
3132
b.iter(|| {
3233
for path in &paths {
@@ -43,7 +44,7 @@ fn bench_vpath_zip(c: &mut Criterion) {
4344
"/project/deps/bundle.zip/dist/app.js",
4445
"/deep/path/to/package.zip/nested/file.json",
4546
];
46-
47+
4748
c.bench_function("vpath_zip", |b| {
4849
b.iter(|| {
4950
for path in &paths {
@@ -59,7 +60,7 @@ fn bench_vpath_virtual_zip(c: &mut Criterion) {
5960
"/project/__virtual__/def456/2/node_modules/some-package/bundle.zip/dist/app.js",
6061
"/deep/path/__virtual__/ghi789/1/node_modules/nested/package.zip/src/file.ts",
6162
];
62-
63+
6364
c.bench_function("vpath_virtual_zip", |b| {
6465
b.iter(|| {
6566
for path in &paths {
@@ -81,7 +82,7 @@ fn bench_vpath_edge_cases(c: &mut Criterion) {
8182
"/malformed/__virtual__/incomplete",
8283
"/fake/__virtual__/abc123/not_a_number/path",
8384
];
84-
85+
8586
c.bench_function("vpath_edge_cases", |b| {
8687
b.iter(|| {
8788
for path in &paths {
@@ -102,7 +103,7 @@ fn bench_vpath_mixed_workload(c: &mut Criterion) {
102103
"/project/deps/bundle.zip/nested/file.json",
103104
"/home/user/project/src/main.rs",
104105
];
105-
106+
106107
c.bench_function("vpath_mixed_workload", |b| {
107108
b.iter(|| {
108109
for path in &paths {
@@ -112,13 +113,10 @@ fn bench_vpath_mixed_workload(c: &mut Criterion) {
112113
});
113114
}
114115

115-
criterion_group!(
116-
benches,
117-
bench_vpath_native,
118-
bench_vpath_virtual,
119-
bench_vpath_zip,
120-
bench_vpath_virtual_zip,
121-
bench_vpath_edge_cases,
122-
bench_vpath_mixed_workload,
123-
);
116+
criterion_group! {
117+
name = benches;
118+
config = Criterion::default().sample_size(1000).measurement_time(Duration::from_secs(10));
119+
targets = bench_vpath_native, bench_vpath_virtual, bench_vpath_zip, bench_vpath_virtual_zip, bench_vpath_edge_cases, bench_vpath_mixed_workload
120+
}
121+
124122
criterion_main!(benches);

0 commit comments

Comments
 (0)