| OLD | NEW |
| 1 Contents | 1 Contents |
| 2 -------- | 2 -------- |
| 3 | 3 |
| 4 This folder contains three kinds of file: | 4 This folder contains three kinds of file: |
| 5 | 5 |
| 6 - Code, such as ProtoBench.java, to build the benchmarking framework. | 6 - Code, such as ProtoBench.java, to build the benchmarking framework. |
| 7 - Protocol buffer definitions (.proto files) | 7 - Protocol buffer definitions (.proto files) |
| 8 - Sample data files | 8 - Sample data files |
| 9 | 9 |
| 10 If we end up with a lot of different benchmarks it may be worth | 10 If we end up with a lot of different benchmarks it may be worth |
| 11 separating these out info different directories, but while there are | 11 separating these out info different directories, but while there are |
| 12 so few they might as well all be together. | 12 so few they might as well all be together. |
| 13 | 13 |
| 14 Running a benchmark (Java) | 14 Running a benchmark (Java) |
| 15 -------------------------- | 15 -------------------------- |
| 16 | 16 |
| 17 1) Build protoc and the Java protocol buffer library. The examples | 17 1) Build protoc and the Java protocol buffer library. The examples |
| 18 below assume a jar file (protobuf.jar) has been built and copied | 18 below assume a jar file (protobuf.jar) has been built and copied |
| 19 into this directory. | 19 into this directory. |
| 20 | 20 |
| 21 2) Build ProtoBench: | 21 2) Build ProtoBench: |
| 22 $ javac -d tmp -cp protobuf.jar ProtoBench.java | 22 $ javac -d tmp -cp protobuf.jar ProtoBench.java |
| 23 | 23 |
| 24 3) Generate code for the relevant benchmark protocol buffer, e.g. | 24 3) Generate code for the relevant benchmark protocol buffer, e.g. |
| 25 $ protoc --java_out=tmp google_size.proto google_speed.proto | 25 $ protoc --java_out=tmp google_size.proto |
| 26 | 26 |
| 27 4) Build the generated code, e.g. | 27 4) Build the generated code, e.g. |
| 28 $ cd tmp | 28 $ javac -d tmp -cp protobuf.jar tmp/benchmarks/*.java |
| 29 $ javac -d . -cp ../protobuf.jar benchmarks/*.java | |
| 30 | 29 |
| 31 5) Run the test. Arguments are given in pairs - the first argument | 30 5) Run the test. Arguments are given in pairs - the first argument |
| 32 is the descriptor type; the second is the filename. For example: | 31 is the descriptor type; the second is the filename. For example: |
| 33 $ java -cp .;../protobuf.jar com.google.protocolbuffers.ProtoBench | 32 $ java -cp tmp:protobuf.jar com.google.protocolbuffers.ProtoBench \ |
| 34 benchmarks.GoogleSize$SizeMessage1 ../google_message1.dat | 33 'benchmarks.GoogleSize$SizeMessage1' google_message1.dat \ |
| 35 benchmarks.GoogleSpeed$SpeedMessage1 ../google_message1.dat | 34 'benchmarks.GoogleSize$SizeMessage2' google_message2.dat |
| 36 benchmarks.GoogleSize$SizeMessage2 ../google_message2.dat | |
| 37 benchmarks.GoogleSpeed$SpeedMessage2 ../google_message2.dat | |
| 38 | 35 |
| 39 6) Wait! Each test runs for around 30 seconds, and there are 6 tests | 36 6) Wait! Each test runs for around 30 seconds, and there are 8 tests |
| 40 per class/data combination. The above command would therefore take | 37 per class/data combination. The above command would therefore take |
| 41 about 12 minutes to run. | 38 about 8 minutes to run. |
| 42 | 39 |
| 43 | 40 |
| 44 Benchmarks available | 41 Benchmarks available |
| 45 -------------------- | 42 -------------------- |
| 46 | 43 |
| 47 From Google: | 44 From Google: |
| 48 google_size.proto and google_speed.proto, messages | 45 google_size.proto, |
| 49 google_message1.dat and google_message2.dat. The proto files are | 46 messages google_message1.dat and google_message2.dat. |
| 50 equivalent, but optimized differently. | |
| OLD | NEW |