-
Notifications
You must be signed in to change notification settings - Fork 1.2k
LambdaMetafactory support for property fetches #2985
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Another PR on improving getter access
|
@bbakerman I think is worth to also benchmark on JDK 17. |
Fixed test where parameters are present
Benchmark fix up
|
JDK 17 |
| } | ||
|
|
||
| private static class CachedFunction { | ||
| Function<Object, Object> getter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember reading that declaring fields final might improve method reference performance so it might apply here. Although maybe it was just static final constants.
| Function<Object, Object> getterFunction = mkCallFunction(sourceClass, candidateMethod.getName(), candidateMethod.getReturnType()); | ||
| return Optional.of(getterFunction); | ||
| } catch (Throwable ignore) { | ||
| // if we can make a dynamic lambda here, then we give up and let the old property fetching code do its thing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // if we can make a dynamic lambda here, then we give up and let the old property fetching code do its thing | |
| // if we can't make a dynamic lambda here, then we give up and let the old property fetching code do its thing |
Another PR on improving getter access. Thanks to @arlampin for the inspiration.
https://wttech.blog/blog/2020/method-handles-and-lambda-metafactory/
https://www.optaplanner.org/blog/2018/01/09/JavaReflectionButMuchFaster.html
Early benchmarks on direct access versus lambda access versus the reflection method access we have today
JDK 1.8.0_191, Java HotSpot(TM) 64-Bit Server VM, 25.191-b12 - Mac M1