-
Notifications
You must be signed in to change notification settings - Fork 102
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
Performance improvement with reflection In AJAXRenderer #1195
Comments
Sounds like a simple change with almost no negative impact. I suggest we'll add it. |
Only problem i use ConcurrentReferenceHashMap from spring, but i see that spring is licensed under apache v2 license same as this project so we can copy it and remove spring imports only keep notes. I probably can make slightly modification of code because ConcurrentReferenceHashMap I can do it as pull request on which branch i need start pull request ? |
Improved version |
If you extract the content of the However, I'm confused by the if (m.getParameterCount() == 0
&& m.getReturnType() == String.class
&& nameOfMethod.equalsIgnoreCase(m.getName())) {
methodsCache.put(cacheName, m);
return m;
} |
I take from https://github.com/TheCoder4eu/BootsFaces-OSP/blob/master/src/main/java/net/bootsfaces/component/ajax/AJAXRenderer.java#L215 |
Just give it a try. Maybe it improves performance, maybe it doesn't. The compiler optimizes short methods earlier than long methods. Inlining is only one of many optimizations. |
nameOfMethod.equalsIgnoreCase i think was added because events are generated from jquery something as i look into code and and its not consistent naming for this in this project. So just not be consistent its used this one not java style but more like javascript style.
but just adding one more call to stack i don't see benefit and if i put cache outside to the methond than i dont like it form redability point. |
In bootfaces 1.5 is not caching reflection invocation for ajax get methods this is significant slow down when you have really many awesome icons without ajax. I override implemnentation with caching with help of class ConcurrentReferenceHashMap.
I just put this class into class directory so that has precedence with original and rendering speed up come up with 20% improvement of speed (like from 100ms to 80ms).
AJAXRenderer.java
The text was updated successfully, but these errors were encountered: