Return-Path: X-Original-To: apmail-jackrabbit-dev-archive@www.apache.org Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DFFF5102E8 for ; Mon, 22 Apr 2013 09:05:18 +0000 (UTC) Received: (qmail 85195 invoked by uid 500); 22 Apr 2013 09:05:18 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 84755 invoked by uid 500); 22 Apr 2013 09:05:17 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 84700 invoked by uid 99); 22 Apr 2013 09:05:16 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Apr 2013 09:05:16 +0000 Date: Mon, 22 Apr 2013 09:05:16 +0000 (UTC) From: "Marcel Reutegger (JIRA)" To: dev@jackrabbit.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (JCR-3571) Light optimizatin for CachingNameResolver.getJCRName(Name) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/JCR-3571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Marcel Reutegger resolved JCR-3571. ----------------------------------- Resolution: Fixed Fix Version/s: 2.7 Looks good to me. Applied patch in revision 1470414. Thanks Sergiy. > Light optimizatin 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