Describe the bug
Common code for manual JSON uses Json.createObjectBuilder(), Json.createValue(...) and friends. These methods all delegate to the provider:
public static JsonNumber createValue(Number value) {
return JsonProvider.provider().createValue(value);
}
Unfortunately, the provider is not cached and the provider() method is extremely expensive. When we replaced Json with AppJson, the only difference being that the provider is cached as a singleton, a job that took 14 minutes could be completed in 6 seconds. This really makes a difference.
To Reproduce
Use typical code that calls Json.whatever() and measure execution time for a large JSON document.
Expected behavior
The provider is cached so that the expensive initialization is not done every time a new JsonValue is created.
System information:
- OS: Windows, Linux
- Java Version: 17, 21
- Yasson Version: 3.0.4
Additional context
Yasson is pulled in by Quarkus, but that should not make a difference.
Describe the bug
Common code for manual JSON uses
Json.createObjectBuilder(),Json.createValue(...)and friends. These methods all delegate to the provider:Unfortunately, the provider is not cached and the
provider()method is extremely expensive. When we replaced Json with AppJson, the only difference being that the provider is cached as a singleton, a job that took 14 minutes could be completed in 6 seconds. This really makes a difference.To Reproduce
Use typical code that calls
Json.whatever()and measure execution time for a large JSON document.Expected behavior
The provider is cached so that the expensive initialization is not done every time a new JsonValue is created.
System information:
Additional context
Yasson is pulled in by Quarkus, but that should not make a difference.