Why is LambdaMetafactory 10% slower than a static MethodHandle but 80% faster than a non-static MethodHandle?
Jochen Theodorou
blackdrag at gmx.org
Mon Feb 19 14:13:33 UTC 2018
On 19.02.2018 14:31, Vladimir Ivanov wrote:
[...]
> CallSites are the best you can get (JITs treat CallSite.target as
> constant and aggressively inlines through them), but you have to bind
> CallSite instance either to invokedynamic call site or put it into
> static final field.
And that really extends to MutableCallsite? In a dynamic language where
you depend on the instance types you cannot do all that much with a
non-mutable callsite.
[...]
> The best thing you can do is to wrap method handle constant into a newly
> created class (put it into constant pool or static final field) and
> define a method which invokes the method handle constant (both indy &
> MH.invokeExact() work). The method should either implement a method from
> super-interface or overrides a method from a super-class (so there's a
> way to directly reference it at use sites). The latter is preferable,
> because invokevirtual is faster than invokeinterface. (LambdaMetafactory
> does the former and that's the reason it can't beat MH.invokeExact() on
> non-constant MH).
that is indeed something to try, nice idea. Now finding the time to
actually do it :(
bye Jochen
More information about the mlvm-dev
mailing list