[
https://issues.apache.org/jira/browse/SLING-3848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14102061#comment-14102061
]
Julian Sedding commented on SLING-3848:
---------------------------------------
I recently had a use-case where I executed a search and read a single property
from each node.
Some micro-benchmarking showed that iterating over 30k nodes and reading one
property took < 10ms using the JCR API (no difference with NodeIterator vs.
RowIterator). The same query and iteration using the Resource API took ~300ms.
I traced this also to the eager initialization of the JcrNodeResource fields
and ResourceMetadata. A large proportion of the time could be attributed to the
node.getPath() call in this scenario. Therefore, I believe it would be
worthwhile to lazily initialize the path field as well.
> JcrNodeResource takes too long and initializes too much too soon
> ----------------------------------------------------------------
>
> Key: SLING-3848
> URL: https://issues.apache.org/jira/browse/SLING-3848
> Project: Sling
> Issue Type: Improvement
> Components: JCR
> Reporter: Rob Ryan
> Assignee: Carsten Ziegeler
> Fix For: JCR Resource 2.3.8, API 2.7.2
>
> Attachments: sling.api.diff, sling.jcr.resource.diff
>
>
> In a performance test expected to reflect reasonably real-world conditions
> (50 concurrent users of a mixed load 'forum' type application) I found
> org.apache.sling.jcr.resource.internal.helper.jcr.JcrNodeResource.JcrNodeResource(ResourceResolver,
> Node, ClassLoader) taking more than 20% of time used. The majority of this
> time was spent in setting the resource metadata and to a lesser extent the
> resource type.
> Because the metadata especially is not often accessed and even the resource
> type is not always accessed, delaying these initializations led to a
> noticeable performance improvement.
> The attached patch delays resourcetype lookup and metadata lookups until
> needed.
--
This message was sent by Atlassian JIRA
(v6.2#6252)