Joerg Hoh created JCRVLT-822:
--------------------------------

             Summary: avoid costly check if a property is protected
                 Key: JCRVLT-822
                 URL: https://issues.apache.org/jira/browse/JCRVLT-822
             Project: Jackrabbit FileVault
          Issue Type: Improvement
          Components: vlt
            Reporter: Joerg Hoh


In the DocViewImporter.updateExistingNode(), there is this check:

{noformat}
                    if (!p.getDefinition().isProtected()
                            && !ni.hasProperty(npResolver.getQName(propName))
                            && !preserveProperties.contains(p.getPath())
                            && wspFilter.includesProperty(p.getPath())) {
{noformat}
([Github|https://github.com/apache/jackrabbit-filevault/blob/ee17857b51bced6e99233a9c52b30cd6074fb28a/vault-core/src/main/java/org/apache/jackrabbit/vault/fs/impl/io/DocViewImporter.java#L1071-L1074])

the check if a property is protected is quite expensive, as it requires the 
EffectiveNodeType to be calculated, so it can be checked if the property is 
protected. It would make sense to move this check to a later position of these 
4 conditions, and move the 2nd check for the first position, as it's cheaper to 
check; assuming that it will returns true not for all of the cases, the "is 
property protected" will be executed less frequently.

When I tested this locally, the re-installation of a already installed package 
(that means: no changes at all) went down from 51 seconds to 43 seconds.





--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to