eclipse-ee4j / eclipse-ee4j/yasson
Improve performance with internal cache of Jsonb instances
- Dominant language
- Java
- Stars
- 218
- Forks
- 109
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 9
Description
The biggest performance issue I see when people use JSON-B is that they create a new `Jsonb` instance on each request. This is understandable because for users that are coming from Jackson, they are used to creating a `new ObjectMapper()` instance on every request.
However, Yasson performs all of its class introspection and annotation scanning scoped per `Jsonb` instance. So if a user does not cache their instance, they are paying the penalty for running the scanning on every request.
Since Jsonb instances are thread-safe, if multiple instances have the same configuration (same JsonbConfig and same JsonProvider), they can be considered the same.
So if a user does:
```java
Jsonb a = JsonbBuilder.create();
Jsonb b = JsonbBuilder.create();
```
We should hand back instances such that `a == b`
Contributor guide
Assessment
This issue has not been assessed yet.