You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:00:03 UTC
[sling-org-apache-sling-resourcemerger] 22/31: SLING-4568 :
Performance: MergingResourceProvider.ParentHidingHandler adds about 30pp
rendering overhead. Apply partial patch from Joel Richard
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.resourcemerger-1.2.10
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourcemerger.git
commit b1a0be799ad6f75517d95e5cd15bb1b669c2e3c7
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Thu Apr 23 09:10:27 2015 +0000
SLING-4568 : Performance: MergingResourceProvider.ParentHidingHandler adds about 30pp rendering overhead. Apply partial patch from Joel Richard
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/resourcemerger@1675563 13f79535-47bb-0310-9956-ffa450edef68
---
.../resourcemerger/impl/MergingResourceProvider.java | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java b/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
index 3bc3af7..fac390c 100644
--- a/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
+++ b/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
@@ -206,12 +206,22 @@ class MergingResourceProvider implements ResourceProvider {
return null;
}
+ boolean first = true;
while (resources.hasNext()) {
final Resource resource = resources.next();
- // check parent for hiding
- // SLING 3521 : if parent is not readable, nothing is hidden
- final Resource parent = resource.getParent();
- final boolean hidden = (parent == null ? false : new ParentHidingHandler(parent).isHidden(holder.name));
+
+ final boolean hidden;
+ if (first) {
+ // The ParentHidingHandler does not have to be executed for the first resource because it isn't an
+ // overlay. This can drastically improve the performance in some cases.
+ hidden = false;
+ first = false;
+ } else {
+ // check parent for hiding
+ // SLING 3521 : if parent is not readable, nothing is hidden
+ final Resource parent = resource.getParent();
+ hidden = (parent == null ? false : new ParentHidingHandler(parent).isHidden(holder.name));
+ }
if (hidden) {
holder.resources.clear();
} else if (!ResourceUtil.isNonExistingResource(resource)) {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.