LambdaMetafactory support for property fetches#2985
Merged
Conversation
Another PR on improving getter access
Member
|
@bbakerman I think is worth to also benchmark on JDK 17. |
Fixed test where parameters are present
Benchmark fix up
Member
Author
|
JDK 17 |
arlampin
reviewed
Oct 17, 2022
| } | ||
|
|
||
| private static class CachedFunction { | ||
| Function<Object, Object> getter; |
Contributor
There was a problem hiding this comment.
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.
dondonz
reviewed
Oct 29, 2022
| 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 |
Member
There was a problem hiding this comment.
Suggested change
| // 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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