Skip to content
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

Create a Java7 ReflectionProvider #66

Open
lucascs opened this issue Oct 8, 2013 · 2 comments
Open

Create a Java7 ReflectionProvider #66

lucascs opened this issue Oct 8, 2013 · 2 comments

Comments

@lucascs
Copy link

lucascs commented Oct 8, 2013

On java 7 we can use MethodHandle's to invoke methods, constructors and getters/setters. This API is faster than pure reflection and will be even faster in Java 8.

Is this possible to adapt the reflection provider to use this new API?

@jonasabreu
Copy link
Member

The reflection providers were created for situations like this. @asouza said he was going to take a look into it, but I don't know if he has made any progress on it.

Do you have a use case that this performance boost would be important? I'm thinking vraptor, but I don't really know enough of the internals to know if this would be the case. If it is, I believe I can spend a couple hours doing it (unless @asouza has already done it and forgot to tell us ;) )

@lucascs
Copy link
Author

lucascs commented Oct 8, 2013

b.c.c.v.c.InvokerReflectionTest.withInvoker        avgt   1     50    1        9.488        0.176    ns/op
b.c.c.v.c.InvokerReflectionTest.withMirror         avgt   1     50    1        8.612        0.047    ns/op
b.c.c.v.c.InvokerReflectionTest.withReflection     avgt   1     50    1        8.127        0.142    ns/op

time in ns.

I don't know if the benchmark is good enough, since I don't fully understand MethodHandles yet.

based on this https://gist.github.com/garcia-jj/6758893

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants