jengebr commented on PR #770:
URL: https://github.com/apache/tomcat/pull/770#issuecomment-2448111787
This complexity led me to try a fallback plan, which can be faster: if the
method has zero parameters, retrieve the Method by name. This works because
there is no confusion about parameter types. Example:
```
if (paramTypes.length == 0) {
try {
Method method = clazz.getMethod(methodName, paramTypes);
return method;
} catch (NoSuchMethodException | SecurityException e) {
// fall through to broader, slower logic
}
}
```
Test data shows this is 2x faster than caching for the fast case, and has no
appreciable impact on the others. That's an excellent outcome for my
application, not sure how you feel about the general case?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]