Repository: tokio-rs/prost (language: rust)

Issue:
cargo bench --workspace fails
Hi!

When I run `cargo bench --workspace` I get the following error:
```
     Running benches/dataset.rs (target/release/deps/dataset-0a8d39c13ac4bd81)
dataset/google_message1_proto2/merge
                        time:   [250.38 ns 250.45 ns 250.52 ns]
Found 4 outliers among 100 measurements (4.00%)
  4 (4.00%) high mild
dataset/google_message1_proto2/encode
                        time:   [146.97 ns 147.85 ns 148.76 ns]
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) low mild
  2 (2.00%) high mild
dataset/google_message1_proto2/encoded_len
                        time:   [36.920 ns 36.921 ns 36.923 ns]
Found 8 outliers among 100 measurements (8.00%)
  1 (1.00%) low mild
  6 (6.00%) high mild
  1 (1.00%) high severe

dataset/google_message1_proto3/merge
                        time:   [196.32 ns 196.54 ns 196.74 ns]
dataset/google_message1_proto3/encode
                        time:   [133.52 ns 133.86 ns 134.19 ns]
dataset/google_message1_proto3/encoded_len
                        time:   [32.852 ns 32.857 ns 32.862 ns]
Found 16 outliers among 100 measurements (16.00%)
  2 (2.00%) high mild
  14 (14.00%) high severe

dataset/google_message2/merge
                        time:   [137.10 µs 137.16 µs 137.24 µs]
dataset/google_message2/encode
                        time:   [54.481 µs 54.501 µs 54.520 µs]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
dataset/google_message2/encoded_len
                        time:   [12.244 µs 12.246 µs 12.249 µs]
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe

Benchmarking dataset/google_message3_1/merge: Warming up for 3.0000 sthread 'main' panicked at protobuf/benches/dataset.rs:29:45:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: bench failed, to rerun pass `-p protobuf --bench dataset`
```

Expected behaviour: the benchmark runs without errors.

`prost` version: `master` branch, `2a4aeafa31dddbfe7d8dd7915c561f95ef45ec93` commit
Rustc version: 1.76
cargo bench --workspace fails
Hi!

When I run `cargo bench --workspace` I get the following error:
```
     Running benches/dataset.rs (target/release/deps/dataset-0a8d39c13ac4bd81)
dataset/google_message1_proto2/merge
                        time:   [250.38 ns 250.45 ns 250.52 ns]
Found 4 outliers among 100 measurements (4.00%)
  4 (4.00%) high mild
dataset/google_message1_proto2/encode
                        time:   [146.97 ns 147.85 ns 148.76 ns]
Found 3 outliers among 100 measurements (3.00%)
  1 (1.00%) low mild
  2 (2.00%) high mild
dataset/google_message1_proto2/encoded_len
                        time:   [36.920 ns 36.921 ns 36.923 ns]
Found 8 outliers among 100 measurements (8.00%)
  1 (1.00%) low mild
  6 (6.00%) high mild
  1 (1.00%) high severe

dataset/google_message1_proto3/merge
                        time:   [196.32 ns 196.54 ns 196.74 ns]
dataset/google_message1_proto3/encode
                        time:   [133.52 ns 133.86 ns 134.19 ns]
dataset/google_message1_proto3/encoded_len
                        time:   [32.852 ns 32.857 ns 32.862 ns]
Found 16 outliers among 100 measurements (16.00%)
  2 (2.00%) high mild
  14 (14.00%) high severe

dataset/google_message2/merge
                        time:   [137.10 µs 137.16 µs 137.24 µs]
dataset/google_message2/encode
                        time:   [54.481 µs 54.501 µs 54.520 µs]
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high mild
dataset/google_message2/encoded_len
                        time:   [12.244 µs 12.246 µs 12.249 µs]
Found 4 outliers among 100 measurements (4.00%)
  3 (3.00%) high mild
  1 (1.00%) high severe

Benchmarking dataset/google_message3_1/merge: Warming up for 3.0000 sthread 'main' panicked at protobuf/benches/dataset.rs:29:45:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: bench failed, to rerun pass `-p protobuf --bench dataset`
```

Expected behaviour: the benchmark runs without errors.

`prost` version: `master` branch, `2a4aeafa31dddbfe7d8dd7915c561f95ef45ec93` commit
Rustc version: 1.76


Discussion / hints:

Fix patch:
diff --git a/protobuf/Cargo.toml b/protobuf/Cargo.toml
index 682f17285..0c17b339f 100644
--- a/protobuf/Cargo.toml
+++ b/protobuf/Cargo.toml
@@ -26,7 +26,6 @@ libz-sys = { version = "1.1, < 1.1.7", optional = true }
 
 [dev-dependencies]
 criterion = { version = "0.4", default-features = false }
-cfg-if = "1"
 
 [lib]
 # https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options
diff --git a/protobuf/benches/dataset.rs b/protobuf/benches/dataset.rs
index ba45a29b6..749829172 100644
--- a/protobuf/benches/dataset.rs
+++ b/protobuf/benches/dataset.rs
@@ -3,14 +3,10 @@ use std::fs::File;
 use std::io::Read;
 use std::path::Path;
 
-use cfg_if::cfg_if;
 use criterion::{criterion_group, criterion_main, Criterion};
 use prost::Message;
 
-use protobuf::benchmarks::{
-    dataset, google_message3::GoogleMessage3, google_message4::GoogleMessage4, proto2, proto3,
-    BenchmarkDataset,
-};
+use protobuf::benchmarks::{dataset, proto2, proto3, BenchmarkDataset};
 
 fn load_dataset(dataset: &Path) -> Result<BenchmarkDataset, Box<dyn Error>> {
     let mut f = File::open(dataset)?;
@@ -83,9 +79,6 @@ macro_rules! dataset {
 dataset!(google_message1_proto2, proto2::GoogleMessage1);
 dataset!(google_message1_proto3, proto3::GoogleMessage1);
 dataset!(google_message2, proto2::GoogleMessage2);
-dataset!(google_message3_1, GoogleMessage3);
-dataset!(google_message3_5, GoogleMessage3);
-dataset!(google_message4, GoogleMessage4);
 
 criterion_group!(
     dataset,
@@ -94,17 +87,4 @@ criterion_group!(
     google_message2,
 );
 
-criterion_group! {
-    name = slow;
-    config = Criterion::default().sample_size(10);
-    targets = google_message3_1, google_message3_5, google_message4
-}
-
-cfg_if! {
-    if #[cfg(debug_assertions)] {
-        // Disable 'slow' benchmarks for unoptimized test builds.
-        criterion_main!(dataset);
-    } else {
-        criterion_main!(dataset, slow);
-    }
-}
+criterion_main!(dataset);
diff --git a/protobuf/build.rs b/protobuf/build.rs
index 683557e0a..72c7d7ee1 100644
--- a/protobuf/build.rs
+++ b/protobuf/build.rs
@@ -17,19 +17,6 @@ static DATASET_PROTOS: &[&str] = &[
     "google_message1/proto2/benchmark_message1_proto2.proto",
     "google_message1/proto3/benchmark_message1_proto3.proto",
     "google_message2/benchmark_message2.proto",
-    "google_message3/benchmark_message3.proto",
-    "google_message3/benchmark_message3_1.proto",
-    "google_message3/benchmark_message3_2.proto",
-    "google_message3/benchmark_message3_3.proto",
-    "google_message3/benchmark_message3_4.proto",
-    "google_message3/benchmark_message3_5.proto",
-    "google_message3/benchmark_message3_6.proto",
-    "google_message3/benchmark_message3_7.proto",
-    "google_message3/benchmark_message3_8.proto",
-    "google_message4/benchmark_message4.proto",
-    "google_message4/benchmark_message4_1.proto",
-    "google_message4/benchmark_message4_2.proto",
-    "google_message4/benchmark_message4_3.proto",
 ];
 
 fn main() -> Result<()> {
diff --git a/protobuf/src/lib.rs b/protobuf/src/lib.rs
index 819708e6b..0255927de 100644
--- a/protobuf/src/lib.rs
+++ b/protobuf/src/lib.rs
@@ -26,35 +26,8 @@ pub mod benchmarks {
                 "/share/dataset.google_message2.pb"
             ))
         }
-
-        pub fn google_message3_1() -> &'static Path {
-            Path::new(concat!(
-                env!("PROTOBUF"),
-                "/share/dataset.google_message3_1.pb"
-            ))
-        }
-
-        pub fn google_message3_5() -> &'static Path {
-            Path::new(concat!(
-                env!("PROTOBUF"),
-                "/share/dataset.google_message3_5.pb"
-            ))
-        }
-
-        pub fn google_message4() -> &'static Path {
-            Path::new(concat!(
-                env!("PROTOBUF"),
-                "/share/dataset.google_message4.pb"
-            ))
-        }
     }
 
-    pub mod google_message3 {
-        include!(concat!(env!("OUT_DIR"), "/benchmarks.google_message3.rs"));
-    }
-    pub mod google_message4 {
-        include!(concat!(env!("OUT_DIR"), "/benchmarks.google_message4.rs"));
-    }
     pub mod proto2 {
         include!(concat!(env!("OUT_DIR"), "/benchmarks.proto2.rs"));
     }


Test patch: