Github user rednaxelafx commented on the issue:
https://github.com/apache/spark/pull/20753
@hvanhovell @kiszk Yes, the old school JDK reflection does perform bytecode
generation to speed it up, since the JDK1.4 era. But the advantage of fully
optimized `MethodHandle` versus reflection `Method.invoke` is that the former
performs privilege checks at `MethodHandle` creation time, whereas the latter
is required to perform privilege checks at every invocation (and that's not
covered by the generated bytecode). So theoretically the `MethodHandle` version
can be faster.
But note that even in OpenJDK8, the HotSpot VM is still exploring ways to
optimize `MethodHandle` performance, and it's somewhat picky about the shape of
the `MethodHandle`s, so it's not like we will always get better performance
just by sticking it in place of reflection. It'll need some tuning /
trial-and-error. We don't have to get it right in the first cut.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]