forked from tokio-rs/prost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Move old protobuf benchmark into prost (tokio-rs#1100)
Add the benchmark protos and datasets from protobuf v3.14 to this repo. The upstream benchmarks have been changed (and later removed) in newer versions of the upstream library. This copy ensures that those benchmarks stay available for prost. This is a requirement for updating to newer upstream protobuf version.
- Loading branch information
1 parent
366c6fb
commit d652301
Showing
17 changed files
with
483 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[workspace] | ||
members = [ | ||
"benchmarks", | ||
"conformance", | ||
"prost", | ||
"prost-build", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
name = "benchmarks" | ||
version = "0.0.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[dependencies] | ||
|
||
[build-dependencies] | ||
prost-build = { path = "../prost-build" } | ||
|
||
[dev-dependencies] | ||
prost = { path = "../prost" } | ||
criterion = { version = "0.5", default-features = false } | ||
|
||
[lib] | ||
# https://bheisler.github.io/criterion.rs/book/faq.html#cargo-bench-gives-unrecognized-option-errors-for-valid-command-line-options | ||
bench = false | ||
|
||
[[bench]] | ||
name = "dataset" | ||
harness = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use std::path::PathBuf; | ||
|
||
static DATASET_PROTOS: &[&str] = &[ | ||
"google_message1/proto2/benchmark_message1_proto2.proto", | ||
"google_message1/proto3/benchmark_message1_proto3.proto", | ||
"google_message2/benchmark_message2.proto", | ||
]; | ||
|
||
fn main() { | ||
let old_protobuf_benchmarks = PathBuf::from("../third_party/old_protobuf_benchmarks"); | ||
|
||
let mut benchmark_protos = vec![old_protobuf_benchmarks.join("benchmarks.proto")]; | ||
benchmark_protos.extend( | ||
DATASET_PROTOS | ||
.iter() | ||
.map(|proto| old_protobuf_benchmarks.join("datasets").join(proto)), | ||
); | ||
prost_build::compile_protos(&benchmark_protos, &[old_protobuf_benchmarks]).unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// This library is empty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# `protobuf` | ||
|
||
`protobuf` is an internal library used by `prost` conformance tests, benchmarks, | ||
`protobuf` is an internal library used by `prost` conformance tests, | ||
and integration-tests. `protobuf` downloads, compiles, and installs the | ||
[Protobuf][1] project, including the conformance test runner, `libprotobuf`, | ||
benchmark data and test and benchmark .protos into the Cargo target directory. | ||
[Protobuf][1] project, including the conformance test runner and `libprotobuf` | ||
into the Cargo target directory. | ||
|
||
[1]: https://github.com/google/protobuf/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Old protobuf benchmarks | ||
|
||
This directory contains the protos and datasets from protobuf v3.14. These benchmarks have been | ||
changed (and later removed) in newer versions of the upstream library. This copy ensures that | ||
those benchmarks stay available for prost. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Protocol Buffers - Google's data interchange format | ||
// Copyright 2008 Google Inc. All rights reserved. | ||
// https://developers.google.com/protocol-buffers/ | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are | ||
// met: | ||
// | ||
// * Redistributions of source code must retain the above copyright | ||
// notice, this list of conditions and the following disclaimer. | ||
// * Redistributions in binary form must reproduce the above | ||
// copyright notice, this list of conditions and the following disclaimer | ||
// in the documentation and/or other materials provided with the | ||
// distribution. | ||
// * Neither the name of Google Inc. nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
syntax = "proto3"; | ||
package benchmarks; | ||
option java_package = "com.google.protobuf.benchmarks"; | ||
|
||
message BenchmarkDataset { | ||
// Name of the benchmark dataset. This should be unique across all datasets. | ||
// Should only contain word characters: [a-zA-Z0-9_] | ||
string name = 1; | ||
|
||
// Fully-qualified name of the protobuf message for this dataset. | ||
// It will be one of the messages defined benchmark_messages_proto2.proto | ||
// or benchmark_messages_proto3.proto. | ||
// | ||
// Implementations that do not support reflection can implement this with | ||
// an explicit "if/else" chain that lists every known message defined | ||
// in those files. | ||
string message_name = 2; | ||
|
||
// The payload(s) for this dataset. They should be parsed or serialized | ||
// in sequence, in a loop, ie. | ||
// | ||
// while (!benchmarkDone) { // Benchmark runner decides when to exit. | ||
// for (i = 0; i < benchmark.payload.length; i++) { | ||
// parse(benchmark.payload[i]) | ||
// } | ||
// } | ||
// | ||
// This is intended to let datasets include a variety of data to provide | ||
// potentially more realistic results than just parsing the same message | ||
// over and over. A single message parsed repeatedly could yield unusually | ||
// good branch prediction performance. | ||
repeated bytes payload = 3; | ||
} |
Oops, something went wrong.