44import com .fasterxml .jackson .core .type .TypeReference ;
55import com .fasterxml .jackson .databind .ObjectMapper ;
66import com .fasterxml .jackson .module .afterburner .AfterburnerModule ;
7+ import com .jsoniter .DecodingMode ;
78import com .jsoniter .JsonIterator ;
89import com .jsoniter .spi .TypeLiteral ;
910import org .junit .Test ;
@@ -35,6 +36,7 @@ public void benchSetup(BenchmarkParams params) {
3536 iter = new JsonIterator ();
3637 modelTypeLiteral = new TypeLiteral <Model >() {
3738 };
39+ JsonIterator .setMode (DecodingMode .DYNAMIC_MODE_AND_MATCH_FIELD_WITH_HASH );
3840 jackson = new ObjectMapper ();
3941 jackson .registerModule (new AfterburnerModule ());
4042 modelTypeReference = new TypeReference <Model >() {
@@ -44,8 +46,7 @@ public void benchSetup(BenchmarkParams params) {
4446 @ Test
4547 public void test () throws IOException {
4648 benchSetup (null );
47- iter .reset (inputBytes );
48- System .out .println (iter .read (modelTypeLiteral ).name );
49+ System .out .println (iter .read (inputBytes , modelTypeLiteral ).name );
4950 System .out .println (JSON .parseObject (input , Model .class ).name );
5051
5152 }
@@ -74,7 +75,7 @@ public void fastjson(Blackhole bh) throws IOException {
7475
7576 @ Benchmark
7677 public void jackson (Blackhole bh ) throws IOException {
77- bh .consume (jackson .readValue (input , modelTypeReference ));
78+ bh .consume (jackson .readValue (inputBytes , modelTypeReference ));
7879 }
7980
8081 public static class Model {
0 commit comments