You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Dennis Kieselhorst (JIRA)" <de...@myfaces.apache.org> on 2017/04/08 07:32:41 UTC
[jira] [Resolved] (TRINIDAD-2434) Usage of Class.getMethod in
TreeRenderer.retrieveGetNodeTypeMethod is a critical performance issue
[ https://issues.apache.org/jira/browse/TRINIDAD-2434?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dennis Kieselhorst resolved TRINIDAD-2434.
------------------------------------------
Resolution: Fixed
> Usage of Class.getMethod in TreeRenderer.retrieveGetNodeTypeMethod is a critical performance issue
> --------------------------------------------------------------------------------------------------
>
> Key: TRINIDAD-2434
> URL: https://issues.apache.org/jira/browse/TRINIDAD-2434
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Components, Facelets
> Affects Versions: 2.0.1-core
> Environment: WebSphere, IBM JRE.
> Reporter: Volker Malzahn
> Assignee: Dennis Kieselhorst
> Priority: Critical
> Fix For: 2.1.3-core
>
>
> We have a webapp with SWF 2.3.0, JSF 2.1 and Trinidad 2.0.1 and have done performance tests in an environment with WebSphere and IBM JRE. When we reached a number of concurrent users of around 80 we get hot spots in calls of Class.getMethod. The stack trace contains following Trinidad method which perform this call often:
> org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.TreeRenderer.getNodeType(UIXHierarchy)
> Inspecting the source of this method I detected that it calls rowClass.getMethod("getNodeType") every time it's called - without caching the method handles reached in previous calls.
> After doing a quick fix for this by caching the method handles we have solved this hot spot:
> private final Map<Class<?>, Method> getNodeTypeMethodMap = new HashMap<Class<?>, Method>();
> private Method retrieveGetNodeTypeMethod(Class rowClass) {
> try {
> synchronized (getNodeTypeMethodMap) {
> if (getNodeTypeMethodMap.containsKey(rowClass)) {
> return getNodeTypeMethodMap.get(rowClass);
> }
> Method getNodeTypeMethod = rowClass.getMethod("getNodeType");
> getNodeTypeMethodMap.put(rowClass, getNodeTypeMethod);
> return getNodeTypeMethod;
> }
> } catch (Exception e) { return null; }
> }
> Could you please fix this for the next Trinidad release?
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)