Charles Oliver Nutter
2018-02-02 12:26:30 UTC
Hey folks!
I'm running some simple benchmarks for my FOSDEM handles talk and wanted to
reopen discussion about the performance of non-static-final method handles.
In my test, I just try to call a method that adds given argument to a
static long. The numbers for reflection and static final handle are what
I'd expect, with the latter basically being equivalent to a direct call:
Direct: 0.05ns/call
Reflected: 3ns/call
static final Handle: 0.05ns/call
If the handle is coming from an instance field or local variable, however,
performance is only slightly faster than reflection. I assume the only real
improvement in this case is that it doesn't box the long value I pass in.
local var Handle: 2.7ns/call
What can we do to improve the performance of non-static method handle
invocation?
- Charlie
I'm running some simple benchmarks for my FOSDEM handles talk and wanted to
reopen discussion about the performance of non-static-final method handles.
In my test, I just try to call a method that adds given argument to a
static long. The numbers for reflection and static final handle are what
I'd expect, with the latter basically being equivalent to a direct call:
Direct: 0.05ns/call
Reflected: 3ns/call
static final Handle: 0.05ns/call
If the handle is coming from an instance field or local variable, however,
performance is only slightly faster than reflection. I assume the only real
improvement in this case is that it doesn't box the long value I pass in.
local var Handle: 2.7ns/call
What can we do to improve the performance of non-static method handle
invocation?
- Charlie