[ https://issues.apache.org/jira/browse/JCR-3571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sergiy Shyrkov updated JCR-3571: -------------------------------- Summary: Light optimization for CachingNameResolver.getJCRName(Name) (was: Light optimizatin for CachingNameResolver.getJCRName(Name)) > Light optimization for CachingNameResolver.getJCRName(Name) > ----------------------------------------------------------- > > Key: JCR-3571 > URL: https://issues.apache.org/jira/browse/JCR-3571 > Project: Jackrabbit Content Repository > Issue Type: Improvement > Components: jackrabbit-spi-commons > Affects Versions: 2.2.13, 2.4.3, 2.5.3, 2.6 > Reporter: Sergiy Shyrkov > Priority: Minor > Fix For: 2.7 > > Attachments: CachingNameResolver.patch > > > In case of a Name which has no namespace (name.getNamespaceURI().length() == > 0) there is perhaps no need to cache the resolved jcrName as it will be > getLocalName(). > If this is true, than I would like to suggest the following slight > optimization in the > org.apache.jackrabbit.spi.commons.conversion.CachingNameResolver.getJCRName(Name) > method: > public String getJCRName(Name name) throws NamespaceException { > if (name.getNamespaceURI().length() == 0) { > return name.getLocalName(); > } > String jcrName = (String) cache.get(name); > ... > This will return earlier and "save" the lookup in the cache and further > cache.put() (the GenerationalCache.put(Object, Object) is synchronized so > avoiding the call makes things potentially faster). > Thank you in advance! -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira