Skip to content

Commit 8ee5d37

Browse files
committed
Adjust Parser Benchmark to measure deeply nested structure.
1 parent abe035c commit 8ee5d37

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

xstream-jmh/src/java/com/thoughtworks/xstream/benchmark/jmh/ParserBenchmark.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2015, 2017, 2021 XStream Committers.
2+
* Copyright (C) 2015, 2017, 2021, 2024 XStream Committers.
33
* All rights reserved.
44
*
55
* The software in this package is published under the terms of the BSD
@@ -18,6 +18,7 @@
1818
import java.util.List;
1919
import java.util.concurrent.TimeUnit;
2020

21+
import org.codehaus.jettison.json.JSONObject;
2122
import org.openjdk.jmh.annotations.Benchmark;
2223
import org.openjdk.jmh.annotations.BenchmarkMode;
2324
import org.openjdk.jmh.annotations.Fork;
@@ -69,6 +70,10 @@
6970
@Threads(1)
7071
@Warmup(iterations = 5)
7172
public class ParserBenchmark {
73+
{
74+
// Increase max recursion depth for Jettison
75+
JSONObject.setGlobalRecursionDepthLimit(2000);
76+
}
7277

7378
/**
7479
* Driver factory. Enum values used as parameter for the parser benchmark methods.
@@ -229,7 +234,7 @@ public void checkData(final Object o) {
229234
}
230235
},
231236
/**
232-
* Nested list in list structure, 500 elements deep.
237+
* Nested list in list structure, 1000 elements deep.
233238
*
234239
* @author Jörg Schaible
235240
* @since 1.4.9
@@ -331,6 +336,7 @@ public void init() {
331336
xstream.addPermission(PrimitiveTypePermission.PRIMITIVES);
332337
xstream.allowTypes(List.class, String.class);
333338
xstream.setMode(XStream.NO_REFERENCES);
339+
xstream.setCollectionUpdateLimit(0);
334340
driver = driverFactory.getDriver();
335341
}
336342

0 commit comments

Comments
 (0)