ArchUnit icon indicating copy to clipboard operation
ArchUnit copied to clipboard

Performance enhancement suggestion: Simplified package matcher that only does a simple "Start with" check for better performance

Open keiki61 opened this issue 5 months ago • 0 comments

Greetings,

We have in our company a lot of arch unit tests running. So I looked into the profiler to see what could be a straight forward way to achieve a runtime performance benefit.

I saw that the packages are being matched using regex. Regex is fast for sure. Yet simple String comparison is even faster.

That's why I created this simplified package matcher. I provide a patch in the attachment.

The performance gain was roughly 10% for my test case.

What do you think? I think it brings enough benefit that it's not premature optimisation.

Example_implementation_of_package_matcher_with_starts_with_implementation_instead_of_using.patch

keiki61 avatar Sep 12 '25 13:09 keiki61