From 1fc736ef7840ad986e7f6e185c242489e97f3400 Mon Sep 17 00:00:00 2001 From: Casper Meijn Date: Tue, 23 Apr 2024 16:16:12 +0200 Subject: [PATCH] Remove GoogleMessage3 and GoogleMessage4 benchmarks (#1037) The dataset for these benchmarks are not distributed in upstream protobuf. Therefore they fail when running `cargo bench --workspace`. Fixes #1005 Open question: - Are these datasets available for download? If yes, we could add them to the repo. --- protobuf/Cargo.toml | 1 - protobuf/benches/dataset.rs | 24 ++---------------------- protobuf/build.rs | 13 ------------- protobuf/src/lib.rs | 27 --------------------------- 4 files changed, 2 insertions(+), 63 deletions(-) diff --git a/protobuf/Cargo.toml b/protobuf/Cargo.toml index c2d4fd6c7..178fad948 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> { 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")); }