Skip to content

Conversation

@jbescos
Copy link
Member

@jbescos jbescos commented Oct 29, 2024

…value() eclipse-ee4j#5782

Signed-off-by: Jorge Bescos Gascon <jorge.bescos.gascon@oracle.com>
@jansupol
Copy link
Contributor

@jbescos I assume this is better performance-wise since the try-catch clause is slow in general. On the other hand, this code tests all the methods and iterates through them. I expect only a very limited number of methods and hence a speedup, but...have you tried to test the performance a bit with this (I do not mean a Jersey test of any kind, more a loop of numerous operations checking for the "value")? The code around the parameter class is utilized quite often in the runtime and can have a measurable impact.

@jbescos
Copy link
Member Author

jbescos commented Oct 29, 2024

I am running it, and I am surprised that the #getMethod performs only 25% slower when there are only 3 methods. When there are many methods (for example when you iterate the methods in String class), in the worst scenario, iterating all the methods is around 300% slower.

Till this point, it looks better to use #getMethod.

However, if exception is thrown because there is no such method, #getMethod performs 1200% slower than iterating 3 methods, and 200% slower iterating the methods of a String.

@senivam senivam merged commit bd6edcd into eclipse-ee4j:2.x Nov 13, 2024
7 checks passed
@senivam senivam added this to the 2.46 milestone Nov 13, 2024
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

Successfully merging this pull request may close these issues.

Jersey 3.1.9: java.lang.NoSuchMethodException: jakarta.inject.Inject.value()

3 participants