Skip to content

Commit

Permalink
Adjust Parser Benchmark to measure deeply nested structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
joehni committed Oct 28, 2024
1 parent abe035c commit 8ee5d37
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2015, 2017, 2021 XStream Committers.
* Copyright (C) 2015, 2017, 2021, 2024 XStream Committers.
* All rights reserved.
*
* The software in this package is published under the terms of the BSD
Expand All @@ -18,6 +18,7 @@
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.codehaus.jettison.json.JSONObject;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
Expand Down Expand Up @@ -69,6 +70,10 @@
@Threads(1)
@Warmup(iterations = 5)
public class ParserBenchmark {
{
// Increase max recursion depth for Jettison
JSONObject.setGlobalRecursionDepthLimit(2000);
}

/**
* Driver factory. Enum values used as parameter for the parser benchmark methods.
Expand Down Expand Up @@ -229,7 +234,7 @@ public void checkData(final Object o) {
}
},
/**
* Nested list in list structure, 500 elements deep.
* Nested list in list structure, 1000 elements deep.
*
* @author Jörg Schaible
* @since 1.4.9
Expand Down Expand Up @@ -331,6 +336,7 @@ public void init() {
xstream.addPermission(PrimitiveTypePermission.PRIMITIVES);
xstream.allowTypes(List.class, String.class);
xstream.setMode(XStream.NO_REFERENCES);
xstream.setCollectionUpdateLimit(0);
driver = driverFactory.getDriver();
}

Expand Down

0 comments on commit 8ee5d37

Please sign in to comment.