Details
-
Sub-task
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.6
Description
Apache Sling uses Session.getNamespacePrefixes() quite often. E.g. when reading content through a JcrPropertyMap:
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)
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.
Attachments
Issue Links
- relates to
-
OAK-2707 Performance: Consider cache for SessionImpl#getNamespacePrefixes
- Resolved