Hi guys,
I ran the following JMH benchmark on JDK 9 and JDK 8.
Source code and detailed results below.
Benchmark on JDK 9 Score
staticMethodHandle 2.770
lambdaMetafactory 3.052 // 10% slower
nonStaticMethodHandle 5.250 // 90% slower
Why is LambdaMetafactory 10%
Geoffrey,
In both staticMethodHandle & lambdaMetafactory Dog::getName is inlined,
but using different mechanisms.
In staticMethodHandle target method is statically known [1], but in case
of lambdaMetafactory [2] compiler has to rely on profiling info to
devirtualize Function::apply(). The la
Am 19.02.2018 um 13:00 schrieb Vladimir Ivanov:
Geoffrey,
In both staticMethodHandle & lambdaMetafactory Dog::getName is inlined,
but using different mechanisms.
In staticMethodHandle target method is statically known [1], but in case
of lambdaMetafactory [2] compiler has to rely on profil
In both staticMethodHandle & lambdaMetafactory Dog::getName is
inlined, but using different mechanisms.
In staticMethodHandle target method is statically known [1], but in
case of lambdaMetafactory [2] compiler has to rely on profiling info
to devirtualize Function::apply(). The latter require
Thank you for the insight, Vladimir.
In staticMethodHandle target method is statically known [1], but in
case of lambdaMetafactory [2] compiler has to rely on profiling info
to devirtualize Function::apply(). The latter requires exact type
check on the receiver at runtime and that explains the
In staticMethodHandle target method is statically known [1], but in
case of lambdaMetafactory [2] compiler has to rely on profiling info
to devirtualize Function::apply(). The latter requires exact type
check on the receiver at runtime and that explains the difference you
are seeing.
Ah, so i
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 exte
On 2/19/18 5:13 PM, Jochen Theodorou wrote:
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 i
- Mail original -
> De: "Vladimir Ivanov"
> À: "Jochen Theodorou" , "Da Vinci Machine Project"
>
> Envoyé: Lundi 19 Février 2018 15:47:45
> Objet: Re: Why is LambdaMetafactory 10% slower than a static MethodHandle but
> 80% faster than a non-static MethodHandle?
> On 2/19/18 5:13 PM,
> However, for java framework developers,
> it would be really useful to have inlining for non-static method handles
too (see Charles's thread),
Is the problem that non-static MethodHandle doesn't get customized, or it's
because in the benchmark, each time it will use a new MethodHandle from
refle
Never mind. I miss some points in the previous discussion. Static method
handle can get further benefit from JIT:
> JIT-compiler extracts method handle instance from static final field (as
if it were a constant from class constant pool) and inlines through
MH.invokeExact() down to the target metho
On 2/19/18 11:43 PM, Wenlei Xie wrote:
Never mind. I miss some points in the previous discussion. Static method
handle can get further benefit from JIT:
> JIT-compiler extracts method handle instance from static final field
(as if it were a constant from class constant pool) and inlines thr
Thank you Vladimir for the explanation!
> In both staticMethodHandle & lambdaMetafactory Dog::getName is inlined,
but using different mechanisms.
> In staticMethodHandle target method is statically known [1], but in case
of lambdaMetafactory [2] compiler has to rely on profiling info to
devirtual
Sorry if it's a dumb question, but why nonStaticMethodHandle cannot get
inlined here? -- In the benchmark it's always the same line with the
same final MethodHandle variable, can JIT based on some profiling info
to inline it (similar to the function object generated by
LambdaMetafactory). --
On 20.02.2018 00:14, Vladimir Ivanov wrote:
Sorry if it's a dumb question, but why nonStaticMethodHandle cannot
get inlined here? -- In the benchmark it's always the same line with
the same final MethodHandle variable, can JIT based on some profiling
info to inline it (similar to the function
15 matches
Mail list logo