Unverified Commit 173f3043 authored by Yilun Chong's avatar Yilun Chong Committed by GitHub

Merge pull request #3926 from BSBandme/down_sync_benchmark

Sync benchmark changes from internal
parents db7c043f 1fd6c176
This diff is collapsed.
This diff is collapsed.
...@@ -7,19 +7,42 @@ protobuf language runtime. ...@@ -7,19 +7,42 @@ protobuf language runtime.
The schema for the datasets is described in `benchmarks.proto`. The schema for the datasets is described in `benchmarks.proto`.
Generate the data sets like so: To run all the benchmark dataset:
For java:
```
$ make java
```
For cpp:
``` ```
$ make $ make cpp
$ ./generate-datasets
Wrote dataset: dataset.google_message1_proto3.pb
Wrote dataset: dataset.google_message1_proto2.pb
Wrote dataset: dataset.google_message2.pb
$
``` ```
Each data set will be written to its own file. Benchmarks will To run a specific dataset:
likely want to run several benchmarks against each data set (parse,
For java:
```
$ make java
$ ./java-benchmark $(specific generated dataset file name)
```
For cpp:
```
$ make cpp
$ ./cpp-benchmark $(specific generated dataset file name)
```
Each data set is in the format of benchmarks.proto:
1. name is the benchmark dataset's name.
2. message_name is the benchmark's message type full name (including package and message name)
3. payload is the list of raw data.
Benchmark likely want to run several benchmarks against each data set (parse,
serialize, possibly JSON, possibly using different APIs, etc). serialize, possibly JSON, possibly using different APIs, etc).
We would like to add more data sets. In general we will favor data sets We would like to add more data sets. In general we will favor data sets
......
...@@ -28,13 +28,16 @@ ...@@ -28,13 +28,16 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <glob.h>
#include <iostream>
#include <fstream> #include <fstream>
#include <iostream>
#include "benchmark/benchmark_api.h" #include "benchmark/benchmark_api.h"
#include "benchmarks.pb.h" #include "benchmarks.pb.h"
#include "benchmark_messages_proto2.pb.h" #include "datasets/google_message1/benchmark_message1_proto2.pb.h"
#include "benchmark_messages_proto3.pb.h" #include "datasets/google_message1/benchmark_message1_proto3.pb.h"
#include "datasets/google_message2/benchmark_message2.pb.h"
#include "datasets/google_message3/benchmark_message3.pb.h"
#include "datasets/google_message4/benchmark_message4.pb.h"
#define PREFIX "dataset." #define PREFIX "dataset."
#define SUFFIX ".pb" #define SUFFIX ".pb"
...@@ -219,6 +222,14 @@ void RegisterBenchmarks(const std::string& dataset_bytes) { ...@@ -219,6 +222,14 @@ void RegisterBenchmarks(const std::string& dataset_bytes) {
RegisterBenchmarksForType<benchmarks::proto2::GoogleMessage1>(dataset); RegisterBenchmarksForType<benchmarks::proto2::GoogleMessage1>(dataset);
} else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage2") { } else if (dataset.message_name() == "benchmarks.proto2.GoogleMessage2") {
RegisterBenchmarksForType<benchmarks::proto2::GoogleMessage2>(dataset); RegisterBenchmarksForType<benchmarks::proto2::GoogleMessage2>(dataset);
} else if (dataset.message_name() ==
"benchmarks.google_message3.GoogleMessage3") {
RegisterBenchmarksForType
<benchmarks::google_message3::GoogleMessage3>(dataset);
} else if (dataset.message_name() ==
"benchmarks.google_message4.GoogleMessage4") {
RegisterBenchmarksForType
<benchmarks::google_message4::GoogleMessage4>(dataset);
} else { } else {
std::cerr << "Unknown message type: " << dataset.message_name(); std::cerr << "Unknown message type: " << dataset.message_name();
exit(1); exit(1);
...@@ -226,15 +237,15 @@ void RegisterBenchmarks(const std::string& dataset_bytes) { ...@@ -226,15 +237,15 @@ void RegisterBenchmarks(const std::string& dataset_bytes) {
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
glob_t glob_result; if (argc == 1) {
if (glob("dataset.*.pb", 0, NULL, &glob_result) != 0) { std::cerr << "Usage: ./cpp-benchmark <input data>" << std::endl;
fprintf(stderr, "No dataset files found.\n"); std::cerr << "input data is in the format of \"benchmarks.proto\""
<< std::endl;
return 1; return 1;
} } else {
for (int i = 1; i < argc; i++) {
for (size_t i = 0; i < glob_result.gl_pathc; i++) { RegisterBenchmarks(ReadFile(argv[i]));
fprintf(stderr, "Found input dataset: %s\n", glob_result.gl_pathv[i]); }
RegisterBenchmarks(ReadFile(glob_result.gl_pathv[i]));
} }
::benchmark::Initialize(&argc, argv); ::benchmark::Initialize(&argc, argv);
......
// Benchmark messages for proto2.
syntax = "proto2";
package benchmarks.proto2;
option java_package = "com.google.protobuf.benchmarks";
// This is the default, but we specify it here explicitly.
option optimize_for = SPEED;
option cc_enable_arenas = true;
message GoogleMessage1 {
required string field1 = 1;
optional string field9 = 9;
optional string field18 = 18;
optional bool field80 = 80 [default = false];
optional bool field81 = 81 [default = true];
required int32 field2 = 2;
required int32 field3 = 3;
optional int32 field280 = 280;
optional int32 field6 = 6 [default = 0];
optional int64 field22 = 22;
optional string field4 = 4;
repeated fixed64 field5 = 5;
optional bool field59 = 59 [default = false];
optional string field7 = 7;
optional int32 field16 = 16;
optional int32 field130 = 130 [default = 0];
optional bool field12 = 12 [default = true];
optional bool field17 = 17 [default = true];
optional bool field13 = 13 [default = true];
optional bool field14 = 14 [default = true];
optional int32 field104 = 104 [default = 0];
optional int32 field100 = 100 [default = 0];
optional int32 field101 = 101 [default = 0];
optional string field102 = 102;
optional string field103 = 103;
optional int32 field29 = 29 [default = 0];
optional bool field30 = 30 [default = false];
optional int32 field60 = 60 [default = -1];
optional int32 field271 = 271 [default = -1];
optional int32 field272 = 272 [default = -1];
optional int32 field150 = 150;
optional int32 field23 = 23 [default = 0];
optional bool field24 = 24 [default = false];
optional int32 field25 = 25 [default = 0];
optional GoogleMessage1SubMessage field15 = 15;
optional bool field78 = 78;
optional int32 field67 = 67 [default = 0];
optional int32 field68 = 68;
optional int32 field128 = 128 [default = 0];
optional string field129 = 129 [default = "xxxxxxxxxxxxxxxxxxxxx"];
optional int32 field131 = 131 [default = 0];
}
message GoogleMessage1SubMessage {
optional int32 field1 = 1 [default = 0];
optional int32 field2 = 2 [default = 0];
optional int32 field3 = 3 [default = 0];
optional string field15 = 15;
optional bool field12 = 12 [default = true];
optional int64 field13 = 13;
optional int64 field14 = 14;
optional int32 field16 = 16;
optional int32 field19 = 19 [default = 2];
optional bool field20 = 20 [default = true];
optional bool field28 = 28 [default = true];
optional fixed64 field21 = 21;
optional int32 field22 = 22;
optional bool field23 = 23 [default = false];
optional bool field206 = 206 [default = false];
optional fixed32 field203 = 203;
optional int32 field204 = 204;
optional string field205 = 205;
optional uint64 field207 = 207;
optional uint64 field300 = 300;
}
...@@ -10,95 +10,28 @@ option optimize_for = SPEED; ...@@ -10,95 +10,28 @@ option optimize_for = SPEED;
option cc_enable_arenas = true; option cc_enable_arenas = true;
message GoogleMessage1 {
required string field1 = 1;
optional string field9 = 9;
optional string field18 = 18;
optional bool field80 = 80 [default=false];
optional bool field81 = 81 [default=true];
required int32 field2 = 2;
required int32 field3 = 3;
optional int32 field280 = 280;
optional int32 field6 = 6 [default=0];
optional int64 field22 = 22;
optional string field4 = 4;
repeated fixed64 field5 = 5;
optional bool field59 = 59 [default=false];
optional string field7 = 7;
optional int32 field16 = 16;
optional int32 field130 = 130 [default=0];
optional bool field12 = 12 [default=true];
optional bool field17 = 17 [default=true];
optional bool field13 = 13 [default=true];
optional bool field14 = 14 [default=true];
optional int32 field104 = 104 [default=0];
optional int32 field100 = 100 [default=0];
optional int32 field101 = 101 [default=0];
optional string field102 = 102;
optional string field103 = 103;
optional int32 field29 = 29 [default=0];
optional bool field30 = 30 [default=false];
optional int32 field60 = 60 [default=-1];
optional int32 field271 = 271 [default=-1];
optional int32 field272 = 272 [default=-1];
optional int32 field150 = 150;
optional int32 field23 = 23 [default=0];
optional bool field24 = 24 [default=false];
optional int32 field25 = 25 [default=0];
optional GoogleMessage1SubMessage field15 = 15;
optional bool field78 = 78;
optional int32 field67 = 67 [default=0];
optional int32 field68 = 68;
optional int32 field128 = 128 [default=0];
optional string field129 = 129 [default="xxxxxxxxxxxxxxxxxxxxx"];
optional int32 field131 = 131 [default=0];
}
message GoogleMessage1SubMessage {
optional int32 field1 = 1 [default=0];
optional int32 field2 = 2 [default=0];
optional int32 field3 = 3 [default=0];
optional string field15 = 15;
optional bool field12 = 12 [default=true];
optional int64 field13 = 13;
optional int64 field14 = 14;
optional int32 field16 = 16;
optional int32 field19 = 19 [default=2];
optional bool field20 = 20 [default=true];
optional bool field28 = 28 [default=true];
optional fixed64 field21 = 21;
optional int32 field22 = 22;
optional bool field23 = 23 [ default=false ];
optional bool field206 = 206 [default=false];
optional fixed32 field203 = 203;
optional int32 field204 = 204;
optional string field205 = 205;
optional uint64 field207 = 207;
optional uint64 field300 = 300;
}
message GoogleMessage2 { message GoogleMessage2 {
optional string field1 = 1; optional string field1 = 1;
optional int64 field3 = 3; optional int64 field3 = 3;
optional int64 field4 = 4; optional int64 field4 = 4;
optional int64 field30 = 30; optional int64 field30 = 30;
optional bool field75 = 75 [default=false]; optional bool field75 = 75 [default = false];
optional string field6 = 6; optional string field6 = 6;
optional bytes field2 = 2; optional bytes field2 = 2;
optional int32 field21 = 21 [default=0]; optional int32 field21 = 21 [default = 0];
optional int32 field71 = 71; optional int32 field71 = 71;
optional float field25 = 25; optional float field25 = 25;
optional int32 field109 = 109 [default=0]; optional int32 field109 = 109 [default = 0];
optional int32 field210 = 210 [default=0]; optional int32 field210 = 210 [default = 0];
optional int32 field211 = 211 [default=0]; optional int32 field211 = 211 [default = 0];
optional int32 field212 = 212 [default=0]; optional int32 field212 = 212 [default = 0];
optional int32 field213 = 213 [default=0]; optional int32 field213 = 213 [default = 0];
optional int32 field216 = 216 [default=0]; optional int32 field216 = 216 [default = 0];
optional int32 field217 = 217 [default=0]; optional int32 field217 = 217 [default = 0];
optional int32 field218 = 218 [default=0]; optional int32 field218 = 218 [default = 0];
optional int32 field220 = 220 [default=0]; optional int32 field220 = 220 [default = 0];
optional int32 field221 = 221 [default=0]; optional int32 field221 = 221 [default = 0];
optional float field222 = 222 [default=0.0]; optional float field222 = 222 [default = 0.0];
optional int32 field63 = 63; optional int32 field63 = 63;
repeated group Group1 = 10 { repeated group Group1 = 10 {
...@@ -115,7 +48,7 @@ message GoogleMessage2 { ...@@ -115,7 +48,7 @@ message GoogleMessage2 {
optional string field16 = 16; optional string field16 = 16;
repeated string field22 = 22; repeated string field22 = 22;
repeated int32 field73 = 73; repeated int32 field73 = 73;
optional int32 field20 = 20 [default=0]; optional int32 field20 = 20 [default = 0];
optional string field24 = 24; optional string field24 = 24;
optional GoogleMessage2GroupedMessage field31 = 31; optional GoogleMessage2GroupedMessage field31 = 31;
} }
...@@ -124,18 +57,18 @@ message GoogleMessage2 { ...@@ -124,18 +57,18 @@ message GoogleMessage2 {
repeated string field127 = 127; repeated string field127 = 127;
optional int32 field129 = 129; optional int32 field129 = 129;
repeated int64 field130 = 130; repeated int64 field130 = 130;
optional bool field205 = 205 [default=false]; optional bool field205 = 205 [default = false];
optional bool field206 = 206 [default=false]; optional bool field206 = 206 [default = false];
} }
message GoogleMessage2GroupedMessage { message GoogleMessage2GroupedMessage {
optional float field1 = 1; optional float field1 = 1;
optional float field2 = 2; optional float field2 = 2;
optional float field3 = 3 [default=0.0]; optional float field3 = 3 [default = 0.0];
optional bool field4 = 4; optional bool field4 = 4;
optional bool field5 = 5; optional bool field5 = 5;
optional bool field6 = 6 [default=true]; optional bool field6 = 6 [default = true];
optional bool field7 = 7 [default=false]; optional bool field7 = 7 [default = false];
optional float field8 = 8; optional float field8 = 8;
optional bool field9 = 9; optional bool field9 = 9;
optional float field10 = 10; optional float field10 = 10;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
syntax = "proto2";
package benchmarks.google_message3;
option cc_enable_arenas = true;
message Message11018 {
}
message Message10800 {
optional string field10808 = 1;
optional int64 field10809 = 2;
optional bool field10810 = 3;
optional float field10811 = 4;
}
message Message10802 {
}
message Message10748 {
optional string field10750 = 1;
optional int32 field10751 = 2;
optional int32 field10752 = 3;
optional int32 field10753 = 4;
}
message Message7966 {
optional string field7969 = 1;
optional bool field7970 = 2;
}
message Message708 {
optional .benchmarks.google_message3.Message741 field823 = 1;
repeated string field824 = 6;
optional string field825 = 2;
optional string field826 = 3;
repeated string field827 = 4;
repeated string field828 = 5;
}
message Message8942 {
}
message Message11011 {
required bytes field11752 = 1;
required bytes field11753 = 2;
}
message UnusedEmptyMessage {
}
message Message741 {
repeated string field936 = 1;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
syntax = "proto2";
import "datasets/google_message4/benchmark_message4_3.proto";
package benchmarks.google_message4;
option cc_enable_arenas = true;
message Message12774 {
optional uint32 field12777 = 1;
optional uint32 field12778 = 2;
optional uint32 field12779 = 3;
optional uint32 field12780 = 4;
optional uint32 field12781 = 5;
optional bool field12782 = 6;
}
message Message12796 {
repeated fixed64 field12800 = 1;
optional uint64 field12801 = 2;
}
message Message12821 {
optional int32 field12848 = 1;
optional int32 field12849 = 2;
optional int32 field12850 = 3;
optional int32 field12851 = 4;
optional int32 field12852 = 5;
}
message Message12820 {
optional int32 field12840 = 1;
optional int32 field12841 = 2;
optional int32 field12842 = 3;
optional int32 field12843 = 8;
optional int32 field12844 = 4;
optional int32 field12845 = 5;
optional int32 field12846 = 6;
optional int32 field12847 = 7;
}
message Message12819 {
optional double field12834 = 1;
optional double field12835 = 2;
optional double field12836 = 3;
optional double field12837 = 4;
optional double field12838 = 5;
optional double field12839 = 6;
}
message Message12818 {
optional uint64 field12829 = 1;
optional int32 field12830 = 2;
optional int32 field12831 = 3;
optional int32 field12832 = 5;
repeated .benchmarks.google_message4.Message12817 field12833 = 4;
}
message Message10319 {
optional .benchmarks.google_message4.Enum10325 field10340 = 1;
optional int32 field10341 = 4;
optional int32 field10342 = 5;
optional bytes field10343 = 3;
optional string field10344 = 2;
optional string field10345 = 6;
optional string field10346 = 7;
}
message Message6578 {
optional .benchmarks.google_message4.Enum6579 field6632 = 1;
optional .benchmarks.google_message4.Enum6588 field6633 = 2;
}
message Message6126 {
required string field6152 = 1;
repeated .benchmarks.google_message4.Message6127 field6153 = 9;
optional int32 field6154 = 14;
optional bytes field6155 = 10;
optional .benchmarks.google_message4.Message6024 field6156 = 12;
optional int32 field6157 = 4;
optional string field6158 = 5;
optional int32 field6159 = 6;
repeated int32 field6160 = 2;
repeated int32 field6161 = 3;
repeated .benchmarks.google_message4.Message6052 field6162 = 7;
repeated .benchmarks.google_message4.UnusedEmptyMessage field6163 = 11;
optional .benchmarks.google_message4.Enum6065 field6164 = 15;
repeated .benchmarks.google_message4.Message6127 field6165 = 8;
optional bool field6166 = 13;
optional bool field6167 = 16;
optional bool field6168 = 18;
repeated .benchmarks.google_message4.Message6054 field6169 = 17;
optional int32 field6170 = 19;
}
message Message5881 {
required double field5897 = 1;
optional string field5898 = 5;
optional .benchmarks.google_message4.Message5861 field5899 = 2;
optional .benchmarks.google_message4.UnusedEmptyMessage field5900 = 3;
optional .benchmarks.google_message4.Message5867 field5901 = 4;
optional .benchmarks.google_message4.Message5880 field5902 = 6;
}
message Message6110 {
}
message Message6107 {
optional .benchmarks.google_message4.Message4016 field6134 = 1;
optional int32 field6135 = 2;
optional string field6136 = 3;
repeated int32 field6137 = 4;
optional int32 field6138 = 5;
repeated .benchmarks.google_message4.Message6108 field6139 = 6;
}
message Message6129 {
required .benchmarks.google_message4.Enum6130 field6171 = 1;
required string field6172 = 2;
}
message Message5908 {
optional string field5971 = 1;
optional int32 field5972 = 2;
optional int32 field5973 = 3;
optional .benchmarks.google_message4.Enum5909 field5974 = 45;
optional .benchmarks.google_message4.Enum5912 field5975 = 4;
optional fixed32 field5976 = 50;
optional fixed32 field5977 = 5;
optional fixed32 field5978 = 6;
optional string field5979 = 7;
optional .benchmarks.google_message4.Enum5915 field5980 = 8;
optional .benchmarks.google_message4.Message5903 field5981 = 9;
optional .benchmarks.google_message4.Message5903 field5982 = 10;
optional .benchmarks.google_message4.Enum5920 field5983 = 11;
optional .benchmarks.google_message4.Enum5923 field5984 = 40;
optional .benchmarks.google_message4.Message5903 field5985 = 41;
optional .benchmarks.google_message4.Message5903 field5986 = 42;
optional .benchmarks.google_message4.Enum5928 field5987 = 47;
optional bool field5988 = 48;
repeated fixed32 field5989 = 49;
optional string field5990 = 12;
optional .benchmarks.google_message4.Message5903 field5991 = 13;
optional .benchmarks.google_message4.Message5903 field5992 = 14;
optional .benchmarks.google_message4.Message5903 field5993 = 15;
optional .benchmarks.google_message4.Message5903 field5994 = 16;
optional .benchmarks.google_message4.Message5903 field5995 = 32;
optional .benchmarks.google_message4.Message5903 field5996 = 33;
optional .benchmarks.google_message4.Message5903 field5997 = 34;
optional .benchmarks.google_message4.Message5903 field5998 = 35;
optional .benchmarks.google_message4.Enum5931 field5999 = 17;
optional .benchmarks.google_message4.Enum5935 field6000 = 18;
optional .benchmarks.google_message4.Enum5939 field6001 = 36;
optional .benchmarks.google_message4.Enum5939 field6002 = 37;
repeated int32 field6003 = 19;
optional uint32 field6004 = 20;
optional uint32 field6005 = 21;
optional uint32 field6006 = 22;
optional uint32 field6007 = 23;
optional .benchmarks.google_message4.Enum5946 field6008 = 24;
optional .benchmarks.google_message4.Enum5946 field6009 = 25;
optional .benchmarks.google_message4.Enum5946 field6010 = 26;
optional .benchmarks.google_message4.Enum5946 field6011 = 27;
optional fixed32 field6012 = 28;
optional fixed32 field6013 = 29;
optional fixed32 field6014 = 30;
optional fixed32 field6015 = 31;
optional int32 field6016 = 38;
optional float field6017 = 39;
optional .benchmarks.google_message4.Enum5957 field6018 = 43;
optional .benchmarks.google_message4.Message5907 field6019 = 44;
optional .benchmarks.google_message4.Enum5962 field6020 = 46;
}
message Message3850 {
optional .benchmarks.google_message4.Enum3851 field3924 = 2;
optional bool field3925 = 12;
optional int32 field3926 = 4;
optional bool field3927 = 10;
optional bool field3928 = 13;
optional bool field3929 = 14;
}
message Message7865 {
}
message Message7511 {
optional bool field7523 = 1;
optional .benchmarks.google_message4.Enum7512 field7524 = 2;
optional int32 field7525 = 3;
optional int32 field7526 = 4;
optional bool field7527 = 5;
optional int32 field7528 = 6;
optional int32 field7529 = 7;
}
message Message3920 {
}
message Message7928 {
optional string field7940 = 1;
optional int64 field7941 = 2;
}
message Message7921 {
optional int32 field7936 = 1;
optional int64 field7937 = 2;
optional float field7938 = 3;
optional .benchmarks.google_message4.Enum7922 field7939 = 4;
}
message Message7920 {
optional int64 field7934 = 1;
optional int64 field7935 = 2;
}
message Message7919 {
optional fixed64 field7931 = 1;
optional int64 field7932 = 2;
optional bytes field7933 = 3;
}
message Message12817 {
optional int32 field12826 = 1;
optional int32 field12827 = 2;
optional int32 field12828 = 3;
}
message Message6054 {
required string field6089 = 1;
optional string field6090 = 2;
}
message Message6127 {
}
message Message6052 {
required string field6084 = 1;
required bytes field6085 = 2;
}
message Message6024 {
optional .benchmarks.google_message4.Enum6025 field6048 = 1;
optional string field6049 = 2;
optional .benchmarks.google_message4.UnusedEmptyMessage field6050 = 3;
}
message Message5861 {
required .benchmarks.google_message4.Enum5862 field5882 = 1;
required string field5883 = 2;
optional bool field5884 = 3;
optional string field5885 = 4;
}
message Message5880 {
optional string field5896 = 1;
}
message Message5867 {
optional .benchmarks.google_message4.Enum5868 field5890 = 1;
optional string field5891 = 2;
optional .benchmarks.google_message4.Enum5873 field5892 = 3;
optional int32 field5893 = 4;
optional .benchmarks.google_message4.UnusedEnum field5894 = 5;
optional bool field5895 = 6;
}
message Message4016 {
required int32 field4017 = 1;
required int32 field4018 = 2;
required int32 field4019 = 3;
required int32 field4020 = 4;
}
message Message6108 {
}
message Message5907 {
optional .benchmarks.google_message4.Message5903 field5967 = 1;
optional .benchmarks.google_message4.Message5903 field5968 = 2;
optional .benchmarks.google_message4.Message5903 field5969 = 3;
optional .benchmarks.google_message4.Message5903 field5970 = 4;
}
message UnusedEmptyMessage {
}
message Message5903 {
required int32 field5965 = 1;
optional .benchmarks.google_message4.Enum5904 field5966 = 2;
}
This diff is collapsed.
#! /bin/sh
curl -O https://storage.googleapis.com/protobuf_opensource_benchmark_data/datasets.tar.gz
tar -zvxf datasets.tar.gz
This diff is collapsed.
Contents
--------
This folder contains three kinds of file:
- Code, such as ProtoBench.java, to build the benchmarking framework.
- Protocol buffer definitions (.proto files)
- Sample data files
If we end up with a lot of different benchmarks it may be worth
separating these out info different directories, but while there are
so few they might as well all be together.
Running a benchmark (Java)
--------------------------
1) Build protoc and the Java protocol buffer library. The examples
below assume a jar file (protobuf.jar) has been built and copied
into this directory.
2) Build ProtoBench:
$ javac -d tmp -cp protobuf.jar ProtoBench.java
3) Generate code for the relevant benchmark protocol buffer, e.g.
$ protoc --java_out=tmp google_size.proto
4) Build the generated code, e.g.
$ javac -d tmp -cp protobuf.jar tmp/benchmarks/*.java
5) Run the test. Arguments are given in pairs - the first argument
is the descriptor type; the second is the filename. For example:
$ java -cp tmp:protobuf.jar com.google.protocolbuffers.ProtoBench \
'benchmarks.GoogleSize$SizeMessage1' google_message1.dat \
'benchmarks.GoogleSize$SizeMessage2' google_message2.dat
6) Wait! Each test runs for around 30 seconds, and there are 8 tests
per class/data combination. The above command would therefore take
about 8 minutes to run.
Benchmarks available
--------------------
From Google:
google_size.proto,
messages google_message1.dat and google_message2.dat.
...@@ -47,7 +47,7 @@ build_cpp() { ...@@ -47,7 +47,7 @@ build_cpp() {
git submodule init git submodule init
git submodule update git submodule update
cd third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make && cd ../.. cd third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make && cd ../..
cd benchmarks && make && ./generate-datasets && cd .. cd benchmarks && make cpp-benchmark && cd ..
else else
echo "" echo ""
echo "WARNING: Skipping validation of the bench marking code, cmake isn't installed." echo "WARNING: Skipping validation of the bench marking code, cmake isn't installed."
......
Subproject commit 5b7683f49e1e9223cf9927b24f6fd3d6bd82e3f8 Subproject commit 360e66c1c4777c99402cf8cd535aa510fee16573
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment