Chameleon icon indicating copy to clipboard operation
Chameleon copied to clipboard

Migrate Adventure mappers to MethodHandles

Open joshuasing opened this issue 2 years ago • 0 comments

Confirmation

  • [X] I have checked for similar issues.

Problem

The Adventure mappers currently use Reflection to invoke "platform Adventure" methods. Reflection is known to be slow, and this can have an impact on performance on platforms where this is required.

Suggested solution

MethodHandles provide an alternative way to invoke methods, whilst being faster than Reflection. However, they are a little bit more complicated and harder to use than Reflection. Additionally, MethodHandles are typed.

If done correctly, I believe moving to MethodHandles would greatly improve the performance of the Adventure mappers, and may allow us to improve the mappers at the same time. Additionally, given MethodHandles are typed, we may be able to catch more issues at compile-time.

Additional information

No response

joshuasing avatar Oct 03 '23 09:10 joshuasing