sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1675563 - /sling/trunk/contrib/extensions/resourcemerger/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
Date Thu, 23 Apr 2015 09:10:27 GMT
Author: cziegeler
Date: Thu Apr 23 09:10:27 2015
New Revision: 1675563

URL: http://svn.apache.org/r1675563
Log:
SLING-4568 : Performance: MergingResourceProvider.ParentHidingHandler adds about 30pp rendering
overhead. Apply partial patch from Joel Richard

Modified:
    sling/trunk/contrib/extensions/resourcemerger/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java

Modified: sling/trunk/contrib/extensions/resourcemerger/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/resourcemerger/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java?rev=1675563&r1=1675562&r2=1675563&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/resourcemerger/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
(original)
+++ sling/trunk/contrib/extensions/resourcemerger/src/main/java/org/apache/sling/resourcemerger/impl/MergingResourceProvider.java
Thu Apr 23 09:10:27 2015
@@ -206,12 +206,22 @@ class MergingResourceProvider implements
                 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)) {



Mime
View raw message