Debian Codegraph @

src/test/java/perf/ReadPerfUntyped.java

raw
1 package perf;
2
3 import java.util.Map;
4
5 import com.fasterxml.jackson.core.*;
6 import com.fasterxml.jackson.databind.*;
7 import com.fasterxml.jackson.dataformat.smile.SmileFactory;
8
9 public class ReadPerfUntyped extends ReaderTestBase
10 {
11 private ReadPerfUntyped() { }
12
13 @Override
14 protected int targetSizeMegs() { return 10; }
15
16 public static void main(String[] args) throws Exception
17 {
18 if (args.length != 1) {
19 System.err.println("Usage: java [input]");
20 System.exit(1);
21 }
22 byte[] json = readAll(args[0]);
23
24 JsonFactory jf = new JsonFactory();
25 SmileFactory sf = new SmileFactory();
26 ObjectMapper m = new ObjectMapper(sf);
27
28 byte[] smile = convert(json, jf, sf);
29
30 // Either Object or Map
31 final Class<?> UNTYPED = Map.class;
32
33 Object input = m.readValue(smile, UNTYPED);
34
35 new ReadPerfUntyped()
36 .testFromBytes(
37 m, "JSON-as-Object", input, UNTYPED
38 ,m, "JSON-as-Object2", input, UNTYPED
39 // ,m, "JSON-as-Node", input2, JsonNode.class
40 );
41 }
42 }