jackrabbit-oak-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Egli (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (OAK-5589) GlobbingPathFilter constructor is expensive
Date Mon, 06 Feb 2017 14:00:43 GMT

     [ https://issues.apache.org/jira/browse/OAK-5589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Stefan Egli updated OAK-5589:
-----------------------------
    Attachment: OAK-5589.patch

Attached [^OAK-5589.patch] with a suggestion for an improvement. With this based on a simplistic
benchmark some 25-30% performance gain was achieved.
[~mduerig] if you find time, can you please review? thx!

> GlobbingPathFilter constructor is expensive
> -------------------------------------------
>
>                 Key: OAK-5589
>                 URL: https://issues.apache.org/jira/browse/OAK-5589
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.6.0
>            Reporter: Stefan Egli
>            Assignee: Stefan Egli
>             Fix For: 1.7.0, 1.8
>
>         Attachments: OAK-5589.patch
>
>
> The [GlobbingPathFilter constructor|https://github.com/apache/jackrabbit-oak/blob/jackrabbit-oak-1.6.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/filter/GlobbingPathFilter.java#L75]
is doing an expensive {{ImmutableList.copyOf}} while traversing down a path as part of filtering.
ImmutableList internally first creates a Builder with capacity 4 - thus frequently has to
do an {{ObjectArrays.arraysCopyOf}}.
> Two things that can be improved here:
> * as suggested by [~mduerig] that [private constructor|https://github.com/apache/jackrabbit-oak/blob/jackrabbit-oak-1.6.0/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/observation/filter/GlobbingPathFilter.java#L74]
- should not copy at all. Only the public constructors should. So the public constructors
should be rewritten to reflect this.
> * {{ImmutableList.copyOf}} cannot be passed an initial capacity unfortunately. Perhaps
there's an alternative for this though.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Mime
View raw message