Skip to content

Commit 797cab4

Browse files
authored
Various small speed improvements (#106)
* Use non synchronized collections * Use empty arrays when transforming collections to arrays * Avoid tokenizing each file name twice * Save a bunch of file system accesses * Save a few percent on parsing
1 parent 3a72ec3 commit 797cab4

File tree

11 files changed

+470
-351
lines changed

11 files changed

+470
-351
lines changed

src/main/java/org/codehaus/plexus/util/AbstractScanner.java

+12-2
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public void setIncludes( String[] includes )
246246
list.add( normalizePattern( include ) );
247247
}
248248
}
249-
this.includes = list.toArray( new String[list.size()] );
249+
this.includes = list.toArray( new String[0] );
250250
}
251251
}
252252

@@ -276,7 +276,7 @@ public void setExcludes( String[] excludes )
276276
list.add( normalizePattern( exclude ) );
277277
}
278278
}
279-
this.excludes = list.toArray( new String[list.size()] );
279+
this.excludes = list.toArray( new String[0] );
280280
}
281281
}
282282

@@ -331,6 +331,11 @@ protected boolean isIncluded( String name, String[] tokenizedName )
331331
return includesPatterns.matches( name, tokenizedName, isCaseSensitive );
332332
}
333333

334+
protected boolean isIncluded( String name, char[][] tokenizedName )
335+
{
336+
return includesPatterns.matches( name, tokenizedName, isCaseSensitive );
337+
}
338+
334339
/**
335340
* Tests whether or not a name matches the start of at least one include pattern.
336341
*
@@ -360,6 +365,11 @@ protected boolean isExcluded( String name, String[] tokenizedName )
360365
return excludesPatterns.matches( name, tokenizedName, isCaseSensitive );
361366
}
362367

368+
protected boolean isExcluded( String name, char[][] tokenizedName )
369+
{
370+
return excludesPatterns.matches( name, tokenizedName, isCaseSensitive );
371+
}
372+
363373
/**
364374
* Adds default exclusions to the current exclusions set.
365375
*/

0 commit comments

Comments
 (0)