gnodet commented on a change in pull request #268:  [MNG-6702] Improve 
DefaultModelValidator speed
URL: https://github.com/apache/maven/pull/268#discussion_r300884890
 
 

 ##########
 File path: 
maven-model-builder/src/main/java/org/apache/maven/model/validation/DefaultModelValidator.java
 ##########
 @@ -268,7 +269,7 @@ else if ( hasProjectExpression( path ) )
     }
 
     private void validate20RawPlugins( ModelProblemCollector problems, 
List<Plugin> plugins, String prefix,
-                                       ModelBuildingRequest request )
+                                       String prefix2, ModelBuildingRequest 
request )
 
 Review comment:
   So the goal of this commit is to avoid concatenating strings which are only 
used in the field name when there is an actual violation.  This field name 
usually looks like `pluginRepositories.pluginRepository.id` but can be a 
concatenation of multiple strings, for example 
`profiles.profile[myprofileid].plugins.plugin.(groupId:artifactId)`.  If we 
could upgrade to JDK8, I would rather use a `Supplier<String>` instead of a 
`String` as the prefix so that the concatenation could happen lazily.  The goal 
here is to avoid all concatenations.  Concatenations are using a StringBuilder 
and thus needs 2 allocations, one for the builder and another one for the 
resulting string.  So when these operations are done hundreds thousands times 
for nothing, it can become a bit expensive.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to