Search in sources :

Example 1 with JsonTypeDefinition

use of voldemort.serialization.json.JsonTypeDefinition in project voldemort by voldemort.

the class TestSerialization method main.

public static void main(String[] args) {
    JsonTypeDefinition def = JsonTypeDefinition.fromJson("[\"int32\"]");
    int size = 30000;
    List<Integer> value = new ArrayList<Integer>(size);
    for (int i = 0; i < size; i++) value.add(i);
    JsonTypeSerializer ser = new JsonTypeSerializer(def);
    long start = System.currentTimeMillis();
    int iters = 100;
    List<byte[]> bytes = new ArrayList<byte[]>(iters);
    for (int i = 0; i < iters; i++) bytes.add(ser.toBytes(value));
    long elapsed = System.currentTimeMillis() - start;
    System.out.println("Took " + (elapsed / iters) + " ms");
}
Also used : JsonTypeSerializer(voldemort.serialization.json.JsonTypeSerializer) JsonTypeDefinition(voldemort.serialization.json.JsonTypeDefinition) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 JsonTypeDefinition (voldemort.serialization.json.JsonTypeDefinition)1 JsonTypeSerializer (voldemort.serialization.json.JsonTypeSerializer)1