[ 
http://issues.apache.org/jira/browse/JCR-235?page=comments#action_12331171 ] 

Jukka Zitting commented on JCR-235:
-----------------------------------

Sounds great! +1 from me, especially the LRUMap is a nice touch, no need to 
worry about DoS threats due to this.

Design comment: The NamespaceRegistryImpl dependency seems out of place. How 
about the following structure?

org.apache.jackrabbit.name:
    public interface NamespaceListener
    public interface QNameResolver
    public class StandardQNameResolver implements QNameResolver
    public class CachingQNameResolver implements QNameResolver, 
NamespaceListener

The static QName.toJCRName and QName.fromJCRName methods could be moved to 
StandardQNameResolver to simplify the QName class.
The CachingQNameResolver could  be implemented as a decorator on top of another 
QNameResolver implementation (StandardQNameResolver by default).
Client code should register and deregister the CachingQNameResolver as a 
namespace change listener.

This structure would add a tiny amount of overhead (a virtual vs. a static 
method call + some extra object instances), but would IMHO add much flexibility 
to the resolution process while keeping the package boundaries nice and solid.

> Cache jcr name to QName mappings
> --------------------------------
>
>          Key: JCR-235
>          URL: http://issues.apache.org/jira/browse/JCR-235
>      Project: Jackrabbit
>         Type: Improvement
>   Components: core
>     Reporter: Marcel Reutegger
>     Assignee: Stefan Guggisberg
>     Priority: Minor
>  Attachments: QNameResolver.patch
>
> Currently jcr names are always parsed and resolved into QName instances. 
> Introducing a cache would increase performance and also save memory because 
> well known and often used jcr names would always return the same QName 
> instance from cache.
> Testing with common read operations shows a performance improvement of about 
> 25%.
> The test involved the following methods on Node interface:
> - getProperty()
> - getProperties()
> - getName()
> - getPath()
> - isLocked()
> - isNodeType()
> - getPrimaryNodeType()
> - hasNodes()
> - getNodes()
> Attached proposed implementation of a QNameResolver.
> Please comment.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to