You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Matthias Weßendorf (JIRA)" <de...@myfaces.apache.org> on 2008/10/03 19:58:44 UTC
[jira] Resolved: (TRINIDAD-1247)
org.apache.myfaces.trinidadinternal.skin.RequestSkinWrapper.getStyleSheetDocumentId
has very poor performance
[ https://issues.apache.org/jira/browse/TRINIDAD-1247?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Matthias Weßendorf resolved TRINIDAD-1247.
------------------------------------------
Resolution: Fixed
Fix Version/s: 1.0.10-core
1.2.10-core
Assignee: Matthias Weßendorf
> org.apache.myfaces.trinidadinternal.skin.RequestSkinWrapper.getStyleSheetDocumentId has very poor performance
> -------------------------------------------------------------------------------------------------------------
>
> Key: TRINIDAD-1247
> URL: https://issues.apache.org/jira/browse/TRINIDAD-1247
> Project: MyFaces Trinidad
> Issue Type: Bug
> Reporter: Stevan Malesevic
> Assignee: Matthias Weßendorf
> Fix For: 1.2.10-core, 1.0.10-core
>
> Attachments: patch.patch
>
>
> Application we use makes a calls to org.apache.myfaces.trinidadinternal.skin.RequestSkinWrapper.getStyleSheetDocumentId for each instance of particular component. So there is a couple of calls per request.
> While looking at CPU and memory usage we noticed that a significant amount is spent in this call. In terms of memory for 45 invocations of this method 5802KB of memory is allocated , which means about 129K per method invocation
> Most of this memory is spent creating Version objects in org.apache.myfaces.trinidadinternal.style.xml.parse.StyleSheetNode.compareVariants.
> To fix this issue we should change StyleSheetNode._compareBrowserAndVersion method to have signature like
> private int _compareBrowserAndVersion(int browser, TrinidadAgent agent)
> and create Version object inside the method just before it is needed. This will greatly reduce the number of Version objects.
> The method looks like this:
> private int _compareBrowserAndVersion(int browser, TrinidadAgent agent)
> {
> // If we don't have a browser specified, we match anything
> if (_agentVersions.isEmpty())
> return _BROWSER_UNKNOWN_MATCH;
> // On the other hand, if we do have a browser specified, but
> // the client browser is not known, we don't have a match
> if (browser == TrinidadAgent.APPLICATION_UNKNOWN)
> return 0;
>
> //If we have browser exact match, compare versions
> Integer browserNum = Integer.valueOf(browser);
> if (_agentVersions.containsKey(browserNum))
> {
> Set<Version> versions = _agentVersions.get(browserNum);
> if (versions.isEmpty())
> return _BROWSER_EXACT_MATCH | _VERSION_UNKNOWN_MATCH;
>
> Version version = new Version(agent.getAgentVersion());
>
> for (Version av : versions)
> {
> if (av.compareTo(version) == 0)
> {
> return _BROWSER_EXACT_MATCH | _VERSION_EXACT_MATCH;
> }
> }
>
> return 0;
> }
> return 0;
> }
> In my test case memory went down to 214K
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.