RFR: 6983726: remove Proxy from MethodHandleProxies.asInterfaceInstance SAM conversion
Chen Liang
liach at openjdk.org
Tue Mar 28 18:32:34 UTC 2023
On Tue, 28 Mar 2023 14:00:41 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
> But this doesn't implement the same ClassValue cache? And spinning byte code can indeed be slow (I've seen this in other profiles).
https://github.com/liachmodded/jdk/commit/821d6b382aeceb70c67c59771deb7438f3b4b7fd
I attempted to spin one class for each mh+interface combination again. The creation time is [halved](https://jmh.morethan.io/?gists=08abb39f224574550925beb8be1b2f59,7fa6627fdd6bbdbd3f5c01ba37247f38) compared to the no-template version, but the creation time is still [very long (factor of 1000)](https://jmh.morethan.io/?gists=e5115a2a8fa0a45159e15fab0d95b5d8,7fa6627fdd6bbdbd3f5c01ba37247f38) compared to the passing to instance approach.
I think we need to determine our approach based on the call patterns of this API:
1. how often asInterfaceInstance is called with the same interface
2. how often asInterfaceInstance is called vs. how often the implementations are called
In addition, we might write a benchmark for fresh creation performance as well (as Proxy does class caching, and LambdaMetafactory also caches class in CallSite). I don't think that asInterfaceInstance class spinning is much slower than metafactory.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/13197#issuecomment-1487412044
More information about the core-libs-dev
mailing list