File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/test/java/com/arangodb/velocypack Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ public class Bench {
2828 public static class Data {
2929
3030 public final String str ;
31+ public final VPackSlice slice ;
3132 public final VPackSlice koko = buildKoko ();
3233
3334 public Data () {
@@ -40,6 +41,9 @@ public Data() {
4041 } catch (Exception e ) {
4142 throw new RuntimeException (e );
4243 }
44+
45+ VPackParser parser = new VPackParser .Builder ().build ();
46+ slice = parser .fromJson (str );
4347 }
4448
4549 public VPackSlice buildKoko () {
@@ -107,8 +111,15 @@ public void sliceGet(Data data, Blackhole bh) {
107111 @ Benchmark
108112 public void fromJson (Data data , Blackhole bh ) {
109113 VPackParser parser = new VPackParser .Builder ().build ();
110-
111114 VPackSlice slice = parser .fromJson (data .str );
112115 bh .consume (slice );
113116 }
117+
118+ @ Benchmark
119+ public void toJson (Data data , Blackhole bh ) {
120+ VPackParser parser = new VPackParser .Builder ().build ();
121+ String str = parser .toJson (data .slice );
122+ bh .consume (str );
123+ }
124+
114125}
You can’t perform that action at this time.
0 commit comments