gnodet commented on pull request #15: URL: https://github.com/apache/maven-common-artifact-filters/pull/15#issuecomment-730701680
I've quite rewritten the class to optimize if in all scenarii. The code of the [match method](https://github.com/gnodet/maven-common-artifact-filters/blob/830b27b5a5aca5f8506b653dc987d893390321cf/src/main/java/org/apache/maven/shared/artifact/filter/PatternIncludesArtifactFilter.java#L345-L496) comes from [plexus-utils](https://github.com/codehaus-plexus/plexus-utils/blob/2c69fc480dee7512f004b0e043a9faf39285f7c2/src/main/java/org/codehaus/plexus/util/SelectorUtils.java#L597-L744) with a small change to support version ranges. The overall code is at least 2 or 3 times faster. ``` Benchmark (patterns) Mode Cnt Score Error Units PatternFilterPerfTest.newPatternTest groupId:artifact-00,... thrpt 3 5812.786 ± 1358.343 ops/ms PatternFilterPerfTest.newPatternTest groupId:artifact-99 thrpt 3 6501.249 ± 453.975 ops/ms PatternFilterPerfTest.newPatternTest groupId:artifact-* thrpt 3 8691.248 ± 3090.282 ops/ms PatternFilterPerfTest.newPatternTest *:artifact-99 thrpt 3 8728.905 ± 2997.482 ops/ms PatternFilterPerfTest.newPatternTest *:artifact-* thrpt 3 8961.616 ± 1186.164 ops/ms PatternFilterPerfTest.newPatternTest *:artifact-*:* thrpt 3 9572.810 ± 2862.009 ops/ms PatternFilterPerfTest.newPatternTest *:artifact-99:* thrpt 3 11016.198 ± 2050.792 ops/ms PatternFilterPerfTest.oldPatternTest groupId:artifact-00,... thrpt 3 273.821 ± 14.881 ops/ms PatternFilterPerfTest.oldPatternTest groupId:artifact-99 thrpt 3 2457.273 ± 383.166 ops/ms PatternFilterPerfTest.oldPatternTest groupId:artifact-* thrpt 3 2401.119 ± 373.818 ops/ms PatternFilterPerfTest.oldPatternTest *:artifact-99 thrpt 3 2449.623 ± 515.837 ops/ms PatternFilterPerfTest.oldPatternTest *:artifact-* thrpt 3 2450.686 ± 778.245 ops/ms PatternFilterPerfTest.oldPatternTest *:artifact-*:* thrpt 3 2165.758 ± 352.249 ops/ms PatternFilterPerfTest.oldPatternTest *:artifact-99:* thrpt 3 2229.319 ± 1037.691 ops/ms ``` ---------------------------------------------------------------- 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