Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
247ef1f0
Commit
247ef1f0
authored
May 03, 2016
by
Josh Haberman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Addressed PR comments.
parent
b2d4b1a5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
55 deletions
+9
-55
benchmark_messages_proto2.proto
benchmarks/benchmark_messages_proto2.proto
+1
-1
benchmark_messages_proto3.proto
benchmarks/benchmark_messages_proto3.proto
+1
-1
benchmarks.proto
benchmarks/benchmarks.proto
+0
-41
generate_datasets.cc
benchmarks/generate_datasets.cc
+7
-12
No files found.
benchmarks/benchmark_messages_proto2.proto
View file @
247ef1f0
...
...
@@ -2,7 +2,7 @@
syntax
=
"proto2"
;
package
benchmarks
.
p2
;
package
benchmarks
.
p
roto
2
;
option
java_package
=
"com.google.protobuf.benchmarks"
;
// This is the default, but we specify it here explicitly.
...
...
benchmarks/benchmark_messages_proto3.proto
View file @
247ef1f0
...
...
@@ -2,7 +2,7 @@
syntax
=
"proto3"
;
package
benchmarks
.
p3
;
package
benchmarks
.
p
roto
3
;
option
java_package
=
"com.google.protobuf.benchmarks"
;
// This is the default, but we specify it here explicitly.
...
...
benchmarks/benchmarks.proto
View file @
247ef1f0
...
...
@@ -61,44 +61,3 @@ message BenchmarkDataset {
// good branch prediction performance.
repeated
bytes
payload
=
3
;
}
// A benchmark can write out metrics that we will then upload to our metrics
// database for tracking over time.
message
Metric
{
// A unique ID for these results. Used for de-duping.
string
guid
=
1
;
// The labels specify exactly what benchmark was run against the dataset.
// The specific benchmark suite can decide what these mean, but here are
// some common labels that have a predefined meaning:
//
// - "dataset": for tests that pertain to a specific dataset.
//
// For example:
//
// # Tests parsing from binary proto string using arenas.
// labels={
// dataset: "testalltypes",
// op: "parse",
// format: "binaryproto",
// input: "string"
// arena: "true"
// }
//
// # Tests serializing to JSON string.
// labels={
// dataset: "testalltypes",
// op: "serialize",
// format: "json",
// input: "string"
// }
map
<
string
,
string
>
labels
=
2
;
// Unit of measurement for the metric:
// - a speed test might be "mb_per_second" or "ops_per_second"
// - a size test might be "kb".
string
unit
=
3
;
// Metric value.
double
value
=
4
;
}
benchmarks/generate_datasets.cc
View file @
247ef1f0
...
...
@@ -28,9 +28,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
const
char
*
file_prefix
=
"dataset."
;
const
char
*
file_suffix
=
".pb"
;
#include <fstream>
#include <iostream>
#include "benchmarks.pb.h"
...
...
@@ -41,10 +38,11 @@ using google::protobuf::DescriptorPool;
using
google
::
protobuf
::
Message
;
using
google
::
protobuf
::
MessageFactory
;
#define ARRAY_TO_STRING(arr) std::string(arr, arr + sizeof(arr))
std
::
set
<
std
::
string
>
names
;
const
char
*
file_prefix
=
"dataset."
;
const
char
*
file_suffix
=
".pb"
;
void
WriteFileWithPayloads
(
const
std
::
string
&
name
,
const
std
::
string
&
message_name
,
const
std
::
vector
<
std
::
string
>&
payload
)
{
...
...
@@ -81,13 +79,10 @@ void WriteFileWithPayloads(const std::string& name,
dataset
.
add_payload
()
->
assign
(
payload
[
i
]);
}
std
::
string
serialized
;
dataset
.
SerializeToString
(
&
serialized
);
std
::
ofstream
writer
;
std
::
string
fname
=
file_prefix
+
name
+
file_suffix
;
writer
.
open
(
fname
.
c_str
());
writer
<<
serialized
;
dataset
.
SerializeToOstream
(
&
writer
)
;
writer
.
close
();
std
::
cerr
<<
"Wrote dataset: "
<<
fname
<<
"
\n
"
;
...
...
@@ -111,12 +106,12 @@ std::string ReadFile(const std::string& name) {
}
int
main
()
{
WriteFile
(
"google_message1_proto3"
,
"benchmarks.p3.GoogleMessage1"
,
WriteFile
(
"google_message1_proto3"
,
"benchmarks.p
roto
3.GoogleMessage1"
,
ReadFile
(
"google_message1.dat"
));
WriteFile
(
"google_message1_proto2"
,
"benchmarks.p2.GoogleMessage1"
,
WriteFile
(
"google_message1_proto2"
,
"benchmarks.p
roto
2.GoogleMessage1"
,
ReadFile
(
"google_message1.dat"
));
// Not in proto3 because it has a group, which is not supported.
WriteFile
(
"google_message2"
,
"benchmarks.p2.GoogleMessage2"
,
WriteFile
(
"google_message2"
,
"benchmarks.p
roto
2.GoogleMessage2"
,
ReadFile
(
"google_message2.dat"
));
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment