MethodHandle lookup&invocation performance
Alexander Turner
nerdscentral at googlemail.com
Sun Jul 10 01:14:20 PDT 2011
John,
Thanks for your fascinating reply. I would just like to clarify something:
"
Another use case which benefits from this particular optimization
trick is "static final" method handles. I.e., if you want to get
invokedynamic-like performance in plain Java code, consider doing your
work by invoking MH constants. This means your bootstrap logic has to
run in the static initializer of the class containing the constants,
which is less flexible (more eager). But it's an option.
"
Is what you are saying here that making a method handle final static
will bring invoke performance closer to invokeExact because the
matching logic only happens once. IE the handle cannot be repatched? I
am not sure I fully understand this because (as I understand it)
making a field final does not do change the way fields in the
reference graph below the field behave. Does a mh 'know' is it final
and so not attempt to mutate itself or anything to which it refers?
On another note - it is great to keep hearing that so much work on
performance is in the pipeline!
Best wishes - AJ
More information about the mlvm-dev
mailing list