Add "per-context" caching of introspection entities (`BasicBeanDescription`?)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- backend, performance
Research direction
Read DeserializationContext and SerializerProvider, then trace how BeanDescription and BasicBeanDescription are obtained; compare the mentioned TypeFactory, JavaType, and AnnotatedClass paths. Run or develop the proposed jmh case using many POJOs and non-reused ObjectMappers. Done means establishing whether per-context reuse is effective and measuring its efficiency.
Written by the indexing model from the issue text.
Description
Since one of bigger costs during initialization (and, for some less optimal cases, not just one-time cost) is introspection of information, it makes sense to try to cache this information somehow.
Unfortunately scoping of caching/reuse is not a trivial thing to do, both regarding what can be reused (can not do per-VM, for example, since mix-ins may vary across mappers), and for how big cache use and how long to retain information.
Finally, there is the question of whether to focus on low-level resolution (TypeFactory + JavaType; AnnotatedClass from ClassIntrospector) or for higher-level entites (BeanDescription).
But since it is likely that in most cases majority of the costs are for a small number of initial calls (mapper readValue and writeValue), and since highest level artifacts (serializers/deserializers) are quite well cached, perhaps it actually would make sense to do something bit different and:
- Only keep reuse "cache" for duration of context (
DeserializationContext,SerializerProvider) onlt - Cache intermediate level entities:
BeanDescription(specifically,BasicBeanDescription).
This seems like a potential win because it would tackle one low-hanging fruit; introspection needed for same type via different properties (via different POJOs). And being per-context, it:
- Need not be thread-safe (only accessed from one thread)
- Had well-defined lifespan so it's short-term garbage (and does not necessarily need to have bound size -- although as a matter of principle probably still should, can just set to a high value)
So let's consider doing this.
About only (?) challenge is that of verifying efficiency of the approach. Would probably make sense to concoct a test case with large (enough) number of POJOs, then running jmh over case of not reusing ObjectMappers, where full introspection cost is incurred for every call.
- Dominant language
- No language data
- Stars
- 6
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FasterXML/jackson3-dev
-
enhancement functionality-change
Difficulty 3/5 1-2 days Newbie friendliness 35/100
FasterXML/jackson3-dev#33 ·
-
Add `writeStartObject(Object, int)` in generator API to support fixed-element writes (CBOR et al) Open
Difficulty 3/5 1-2 days Newbie friendliness 42/100
FasterXML/jackson3-dev#30 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
FasterXML/jackson3-dev#29 ·
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 25/100
FasterXML/jackson3-dev#28 ·
-
Change "invalid subtype" (security check) from `BeanDeserializerFactory` into `ClassNameIdResolver` Open
Difficulty 4/5 3-5 days Newbie friendliness 30/100
FasterXML/jackson3-dev#20 ·
All issues in FasterXML/jackson3-dev
Similar issues
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100