Search in sources :

Example 1 with DataCodec

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);
    }
}
Also used : PsonDataCodec(com.linkedin.data.codec.PsonDataCodec) JacksonDataCodec(com.linkedin.data.codec.JacksonDataCodec) BsonDataCodec(com.linkedin.data.codec.BsonDataCodec) DataCodec(com.linkedin.data.codec.DataCodec) TextDataCodec(com.linkedin.data.codec.TextDataCodec) JacksonDataCodec(com.linkedin.data.codec.JacksonDataCodec) BsonDataCodec(com.linkedin.data.codec.BsonDataCodec) ArrayList(java.util.ArrayList)

Example 2 with DataCodec

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();
}
Also used : PsonDataCodec(com.linkedin.data.codec.PsonDataCodec) DataCodec(com.linkedin.data.codec.DataCodec) JacksonDataCodec(com.linkedin.data.codec.JacksonDataCodec) JacksonDataCodec(com.linkedin.data.codec.JacksonDataCodec) PsonDataCodec(com.linkedin.data.codec.PsonDataCodec) Test(org.testng.annotations.Test)

Aggregations

DataCodec (com.linkedin.data.codec.DataCodec)2 JacksonDataCodec (com.linkedin.data.codec.JacksonDataCodec)2 PsonDataCodec (com.linkedin.data.codec.PsonDataCodec)2 BsonDataCodec (com.linkedin.data.codec.BsonDataCodec)1 TextDataCodec (com.linkedin.data.codec.TextDataCodec)1 ArrayList (java.util.ArrayList)1 Test (org.testng.annotations.Test)1