use of com.linkedin.data.codec.DataCodec in project rest.li by linkedin.
the class TestData method perfTest.
private void perfTest(int count, DataMap map) throws IOException {
List<DataCodec> codecs = new ArrayList<DataCodec>();
codecs.add(new JacksonDataCodec());
//codecs.add(new Bson4JacksonDataCodec());
codecs.add(new BsonDataCodec());
for (DataCodec codec : codecs) {
byte[] bytes = codec.mapToBytes(map);
out.println(codec.getClass().getName() + " serialized size " + bytes.length);
}
for (DataCodec codec : codecs) {
dataMapToBytesPerfTest(count, codec, map);
}
for (DataCodec codec : codecs) {
byte[] bytes = codec.mapToBytes(map);
bytesToDataMapPerfTest(count, codec, bytes);
}
}
use of com.linkedin.data.codec.DataCodec in project rest.li by linkedin.
the class TestCloudPerformance method run.
@Test
public void run() throws IOException {
DataCodec[] codecs = { new JacksonDataCodec(), new PsonDataCodec().setOptions(new PsonDataCodec.Options().setEncodeCollectionCount(false).setEncodeStringLength(false)), new PsonDataCodec().setOptions(new PsonDataCodec.Options().setEncodeCollectionCount(false).setEncodeStringLength(true)), new PsonDataCodec().setOptions(new PsonDataCodec.Options().setEncodeCollectionCount(true).setEncodeStringLength(false)), new PsonDataCodec().setOptions(new PsonDataCodec.Options().setEncodeCollectionCount(true).setEncodeStringLength(true)) };
if (_testOnly == false) {
out.println("Number of elements " + _numElements);
out.println("Number of iterations " + _numIterations);
}
for (DataCodec codec : codecs) {
testSerializeDataMap(codec);
testDeserializeDataMap(codec);
}
testEdgeListAddAll();
testEdgeListEfficientAddAll();
}
Aggregations