JDK-8278447 : Improve performance with the use of catchException and asSpreader combinator
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 18
  • Priority: P3
  • Status: Open
  • Resolution: Unresolved
  • Submitted: 2021-12-08
  • Updated: 2022-09-29
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdUnresolved
Related Reports
Relates :  
Relates :  
Description
JEP 416 implementation does not use catchException and asSpreader combinator because of the performance regression.   In particular the cold startup regression is significant due to the spinning and loading of the lambda classes.

The current implementation decodes from the stack trace to determine if NPE and CCE are thrown due to illegal argument passed to Method::invoke or thrown by the method body so that IAE or ITE is thrown properly.   It also has a specialized logic to avoid using asSpreader if the method has 3 or fewer arguments.    It'd be ideal to improve the performance of catchException and asSpreader or the version specified for core reflection use such that the special logics can be removed.
Comments
The specialized logic avoids the object allocations by asSpreader if the method has 3 or fewer arguments. That affects the runtime performance besides cold startup.
29-09-2022