-
Notifications
You must be signed in to change notification settings - Fork 570
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
Explore MethodHandles usage #917
Conversation
FWIW, the general opinion is that MethodHandles can only get better and be polished in the future. So that would be a good move anyway, if it's at least not slower than what we had. So I would be +1 on pursuing this. |
@marko-bekhta, @gsmet, have you read Geoffrey's recent post on this: https://www.optaplanner.org/blog/2018/01/09/JavaReflectionButMuchFaster.html? It seems the best we can do would be to use code generation for accessing public members and fall back to method handles otherwise. |
@gunnarmorling yes, we already discussed this post and John's results with Marko. We wanted to see what differences will it make in HV to understand better if this approach would be worth it or not. Clearly, I'm against moving to bytecode generation in a micro. Not sure I would move to MethodHandle either tbh - especially since the gain is very minor. I would say let's revisit it once we prepare a 6.1. Things might have evolved in the right way then (maybe by reducing the cost of not having the MH static final). |
@marko-bekhta so on this one, I think it would be worth it to take a first baby step and migrate to |
+1 to introduce the handles first. If we do this right, then replacing it with generated classes shouldn't be a problem (if we could generate a class that we need :)). |
Probably. What bugs me a little is that in the OSGi case, you will be forced to pass a lookup in addition to the current external class loader. I don't see a way to avoid that and this is unfortunate as it will break existing applications. Unless you see a workaround? So for now, I would favor working on things that can bring something to the user as the JSON stuff. |
This was superseded by #975 . |
Do not merge this :) It's just to be able to post jmh results and do some experiments with MH stuff.
@gsmet I've tried a couple things that we talked about yesterday... Here are some first results based on such kind of changes:
Next I've tried to validate a collection of beans (as usual - 100 beans in a list) instead of one and the results I've got are (on a different machine):
I'm a bit surprised to see that big of a jump in case of one bean when a constant field used and such small when just a MH is used as a regular field.
I think that a validation of a collection gives a better picture. I'll play with it a bit more and post the results here.
Note: to see how I've "changed" the location impls just check a corresponding commit.