Skip to content

Commit

Permalink
Remove GoogleMessage3 and GoogleMessage4 benchmarks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
caspermeijn committed Apr 22, 2024
1 parent 0381b93 commit 11fceea
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 63 deletions.
1 change: 0 additions & 1 deletion protobuf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 2 additions & 22 deletions protobuf/benches/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down Expand Up @@ -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,
Expand All @@ -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);
13 changes: 0 additions & 13 deletions protobuf/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<()> {
Expand Down
27 changes: 0 additions & 27 deletions protobuf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down

0 comments on commit 11fceea

Please sign in to comment.