Summary
Record.$computed() (Record.java:2377) and $derived()
(Record.java:2428) memoize their results per instance, but the work
they cache -- scanning the full method hierarchy
(getAllNonOverriddenDefaultInterfaceMethods + getAllDeclaredMethods)
and probing each method for @Computed / @Derived -- produces a
class-level fact. A bulk load of N records of the same class pays N
identical reflective scans.
Implementation Plan
- Move descriptor discovery (which methods are @Computed/@derived, their
resolved keys, and isDefault) into the existing class-keyed
Record.StaticAnalysis inner class, computed once per class.
- Per instance, only bind the suppliers (computed) / evaluate the values
(derived) from the cached descriptors.
Acceptance Criteria
Effort
Small-Medium
Summary
Record.$computed()(Record.java:2377) and$derived()(Record.java:2428) memoize their results per instance, but the work
they cache -- scanning the full method hierarchy
(
getAllNonOverriddenDefaultInterfaceMethods+getAllDeclaredMethods)and probing each method for
@Computed/@Derived-- produces aclass-level fact. A bulk load of N records of the same class pays N
identical reflective scans.
Implementation Plan
resolved keys, and
isDefault) into the existing class-keyedRecord.StaticAnalysisinner class, computed once per class.(derived) from the cached descriptors.
Acceptance Criteria
instance.
evaluate per instance.
Effort
Small-Medium