jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dürig (JIRA) <j...@apache.org>
Subject [jira] [Commented] (OAK-808) Significant performance issue in TargetImportHandler's prefix mapping handling
Date Thu, 02 May 2013 16:10:17 GMT

    [ https://issues.apache.org/jira/browse/OAK-808?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13647656#comment-13647656

Michael Dürig commented on OAK-808:

Good catch, thanks for the patch. I'm not sure whether this is the right thing to do though
since it changes the semantics of {{TargetImportHandler#currentNamePathMapper()}}: without
the patch a caller would observe a certain mapping as it was when the name space map was returned
from {{currentNamePathMapper()}}, whereas with the patch a caller would observe the mapping
at it is at the time he looks into the map. 

> Significant performance issue in TargetImportHandler's prefix mapping handling
> ------------------------------------------------------------------------------
>                 Key: OAK-808
>                 URL: https://issues.apache.org/jira/browse/OAK-808
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: jcr
>    Affects Versions: 0.7
>            Reporter: Lukas Eder
>         Attachments: Screen Shot YourKit Profiling Session.png, TargetImportHandler.java.patch
> While playing around with Oak, I have observed a significant performance bottleneck in

> {code}
> org.apache.jackrabbit.oak.jcr.xml.TargetImportHandler
> {code}
> The problem can be seen in the attached Screenshot taken from a Yourkit profiling session.
The TargetImportHandler contains a reference to a "documentContext" ListMultimap, which acts
like a stack of prefix - namespace mappings. To the outside, however, it is exposed as "documentPrefixMap",
a regular prefix - namespace mapping map, which only references the last namespace for a prefix.
> What's problematic here: "documentPrefixMap" is eagerly copied from "documentContext"
every time the latter is modified, which may happen a lot in upstream products, such as Adobe
CQ5. Instead, "documentPrefixMap" should be a Map view exposing the desired data. An example
implementation using Guava:
> {code}
> // Create this view once, in the constructor
> this.documentPrefixMap = Maps.transformValues(documentContext.asMap(),
>     new Function<Collection<String>, String>() {
>         @Override
>         public String apply(Collection<String> input) {
>             return Iterables.getLast(input, null);
>         }
>     });
> {code}
> The above implementation might work, as "documentPrefixMap" is a read-only view of the
"documentContext" map. More explicit, verbose implementations may prove to be even faster.
> Before I write a patch, please let me know what you think. Having a live view may of
course create concurrency issues, etc.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message