You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Przemo Pakulski (JIRA)" <ji...@apache.org> on 2014/01/02 15:00:55 UTC
[jira] [Commented] (OAK-701) Optimize
Session.getNamespacePrefixes()
[ https://issues.apache.org/jira/browse/OAK-701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13860218#comment-13860218 ]
Przemo Pakulski commented on OAK-701:
-------------------------------------
Could be additionally optimized on Sling side, see https://issues.apache.org/jira/browse/SLING-3304
> Optimize Session.getNamespacePrefixes()
> ---------------------------------------
>
> Key: OAK-701
> URL: https://issues.apache.org/jira/browse/OAK-701
> Project: Jackrabbit Oak
> Issue Type: Sub-task
> Components: jcr
> Affects Versions: 0.6
> Reporter: Marcel Reutegger
> Assignee: Marcel Reutegger
> Priority: Minor
> Labels: performance
> Fix For: 0.7
>
>
> Apache Sling uses Session.getNamespacePrefixes() quite often. E.g. when reading content through a JcrPropertyMap:
> {code}
> java.lang.Thread.State: RUNNABLE
> at java.util.HashMap.put(HashMap.java:372)
> at org.apache.jackrabbit.oak.plugins.name.Namespaces.getNamespaceMap(Namespaces.java:64)
> at org.apache.jackrabbit.oak.plugins.name.ReadOnlyNamespaceRegistry.getPrefix(ReadOnlyNamespaceRegistry.java:116)
> at org.apache.jackrabbit.oak.jcr.SessionImpl.getNamespacePrefix(SessionImpl.java:529)
> - locked <0x00000007daf6c590> (a java.util.HashMap)
> at org.apache.jackrabbit.oak.jcr.SessionImpl.getNamespacePrefixes(SessionImpl.java:495)
> at org.apache.sling.jcr.resource.JcrPropertyMap.escapeKeyName(JcrPropertyMap.java:381)
> at org.apache.sling.jcr.resource.JcrPropertyMap.read(JcrPropertyMap.java:344)
> at org.apache.sling.jcr.resource.JcrPropertyMap.get(JcrPropertyMap.java:126)
> at org.apache.sling.jcr.resource.JcrPropertyMap.get(JcrPropertyMap.java:147)
> {code}
> I'd like to optimize the case when there are not session re-mapped namespaces. In this case the prefixes can be returned from the namespace registry as is. This avoids the loop and reduces calls on the Oak API. Initial testing shows a performance improvement by a factor of 3.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)