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 10773ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions xstream-jmh/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<!--
Copyright (C) 2015, 2017, 2018, 2019, 2020, 2021, 2022, 2023 XStream committers.
Copyright (C) 2015, 2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024 XStream committers.
All rights reserved.
The software in this package is published under the terms of the BSD
Expand Down Expand Up @@ -165,7 +165,7 @@
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<scope>runtime</scope>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
Expand Down
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&ouml;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 10773ac

Please sign in to comment.