[
https://issues.apache.org/jira/browse/JCR-2744?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12908783#action_12908783
]
Michael Dürig commented on JCR-2744:
------------------------------------
This looks very good to me. Do you have some performance figures already?
However I think that RelativePath#getElements() need to improve. The current
implementations recursively calls getElements() on the parent and adds its own
element to the returned array. To do so the returned array needs to be copied.
Copying the array once for each recursive invocation effectively results in
O(n^2) run time characteristics. I suggest to change the recursive
implementation into an iterative one which collects the name elements of all
ancestors of the current path into a pre allocated array.
> Avoid element arrays in PathImpl
> --------------------------------
>
> Key: JCR-2744
> URL: https://issues.apache.org/jira/browse/JCR-2744
> Project: Jackrabbit Content Repository
> Issue Type: Improvement
> Components: jackrabbit-spi, jackrabbit-spi-commons
> Reporter: Jukka Zitting
>
> The path handling code in spi-commons shows quite often in thread dumps and
> profiling results, as the current implementation does quite a bit of
> repetitive allocating and copying of path element arrays. We should be able
> to streamline and simplify the path handling code by only tracking the latest
> path element and a reference to the parent path. To do this efficiently we
> may need to adjust some of the Path and PathFactory method declarations (that
> currently assume element array -based paths) also in the SPI.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.