|
|
@ -1,5 +1,5 @@ |
|
|
|
|
|
|
|
|
|
|
|
package com.google.protocolbuffers; |
|
|
|
package com.google.protobuf; |
|
|
|
|
|
|
|
|
|
|
|
import com.google.caliper.BeforeExperiment; |
|
|
|
import com.google.caliper.BeforeExperiment; |
|
|
|
import com.google.caliper.Benchmark; |
|
|
|
import com.google.caliper.Benchmark; |
|
|
@ -26,7 +26,6 @@ public class ProtoBenchCaliper { |
|
|
|
return com.google.protobuf.benchmarks.BenchmarkMessage1Proto3.GoogleMessage1 |
|
|
|
return com.google.protobuf.benchmarks.BenchmarkMessage1Proto3.GoogleMessage1 |
|
|
|
.getDefaultInstance(); |
|
|
|
.getDefaultInstance(); |
|
|
|
} |
|
|
|
} |
|
|
|
@Override String[] getSpecificCaliperOption() { return null; } |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
GOOGLE_MESSAGE1_PROTO2 { |
|
|
|
GOOGLE_MESSAGE1_PROTO2 { |
|
|
|
@Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); } |
|
|
|
@Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); } |
|
|
@ -35,7 +34,6 @@ public class ProtoBenchCaliper { |
|
|
|
return com.google.protobuf.benchmarks.BenchmarkMessage1Proto2.GoogleMessage1 |
|
|
|
return com.google.protobuf.benchmarks.BenchmarkMessage1Proto2.GoogleMessage1 |
|
|
|
.getDefaultInstance(); |
|
|
|
.getDefaultInstance(); |
|
|
|
} |
|
|
|
} |
|
|
|
@Override String[] getSpecificCaliperOption() { return null; } |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
GOOGLE_MESSAGE2 { |
|
|
|
GOOGLE_MESSAGE2 { |
|
|
|
@Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); } |
|
|
|
@Override ExtensionRegistry getExtensionRegistry() { return ExtensionRegistry.newInstance(); } |
|
|
@ -43,7 +41,6 @@ public class ProtoBenchCaliper { |
|
|
|
Message getDefaultInstance() { |
|
|
|
Message getDefaultInstance() { |
|
|
|
return com.google.protobuf.benchmarks.BenchmarkMessage2.GoogleMessage2.getDefaultInstance(); |
|
|
|
return com.google.protobuf.benchmarks.BenchmarkMessage2.GoogleMessage2.getDefaultInstance(); |
|
|
|
} |
|
|
|
} |
|
|
|
@Override String[] getSpecificCaliperOption() { return null; } |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
GOOGLE_MESSAGE3 { |
|
|
|
GOOGLE_MESSAGE3 { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -64,12 +61,6 @@ public class ProtoBenchCaliper { |
|
|
|
Message getDefaultInstance() { |
|
|
|
Message getDefaultInstance() { |
|
|
|
return benchmarks.google_message3.BenchmarkMessage3.GoogleMessage3.getDefaultInstance(); |
|
|
|
return benchmarks.google_message3.BenchmarkMessage3.GoogleMessage3.getDefaultInstance(); |
|
|
|
} |
|
|
|
} |
|
|
|
@Override |
|
|
|
|
|
|
|
String[] getSpecificCaliperOption() { |
|
|
|
|
|
|
|
String[] opt = new String[1]; |
|
|
|
|
|
|
|
opt[0] = "-Cinstrument.runtime.options.timingInterval=3000ms"; |
|
|
|
|
|
|
|
return opt; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
GOOGLE_MESSAGE4 { |
|
|
|
GOOGLE_MESSAGE4 { |
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -85,17 +76,10 @@ public class ProtoBenchCaliper { |
|
|
|
Message getDefaultInstance() { |
|
|
|
Message getDefaultInstance() { |
|
|
|
return benchmarks.google_message4.BenchmarkMessage4.GoogleMessage4.getDefaultInstance(); |
|
|
|
return benchmarks.google_message4.BenchmarkMessage4.GoogleMessage4.getDefaultInstance(); |
|
|
|
} |
|
|
|
} |
|
|
|
@Override |
|
|
|
|
|
|
|
String[] getSpecificCaliperOption() { |
|
|
|
|
|
|
|
String[] opt = new String[1]; |
|
|
|
|
|
|
|
opt[0] = "-Cinstrument.runtime.options.timingInterval=3000ms"; |
|
|
|
|
|
|
|
return opt; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
abstract ExtensionRegistry getExtensionRegistry(); |
|
|
|
abstract ExtensionRegistry getExtensionRegistry(); |
|
|
|
abstract Message getDefaultInstance(); |
|
|
|
abstract Message getDefaultInstance(); |
|
|
|
abstract String[] getSpecificCaliperOption(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Param |
|
|
|
@Param |
|
|
@ -112,8 +96,6 @@ public class ProtoBenchCaliper { |
|
|
|
private List<ByteString> inputStringList; |
|
|
|
private List<ByteString> inputStringList; |
|
|
|
private List<Message> sampleMessageList; |
|
|
|
private List<Message> sampleMessageList; |
|
|
|
private int counter; |
|
|
|
private int counter; |
|
|
|
private FileOutputStream devNull; |
|
|
|
|
|
|
|
private CodedOutputStream reuseDevNull; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@BeforeExperiment |
|
|
|
@BeforeExperiment |
|
|
|
void setUp() throws IOException { |
|
|
|
void setUp() throws IOException { |
|
|
@ -135,15 +117,6 @@ public class ProtoBenchCaliper { |
|
|
|
sampleMessageList.add( |
|
|
|
sampleMessageList.add( |
|
|
|
defaultMessage.newBuilderForType().mergeFrom(singleInputData, extensions).build()); |
|
|
|
defaultMessage.newBuilderForType().mergeFrom(singleInputData, extensions).build()); |
|
|
|
} |
|
|
|
} |
|
|
|
devNull = null; |
|
|
|
|
|
|
|
reuseDevNull = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
devNull = new FileOutputStream("/dev/null"); |
|
|
|
|
|
|
|
reuseDevNull = CodedOutputStream.newInstance(devNull); |
|
|
|
|
|
|
|
} catch (FileNotFoundException e) { |
|
|
|
|
|
|
|
// ignore: this is probably Windows, where /dev/null does not exist
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
counter = 0; |
|
|
|
counter = 0; |
|
|
|
} |
|
|
|
} |