String.equals() eventually calls StringLatin1.equals() which uses processor-specific intrinsics. They are available for major architectures and typically use some sort of processor-optimized vector operations, which should be faster than the current for-loop.
Before:
After:
Comment From: poutsma
I changed the PR to remove the char[]
field in favor of the String
, as both contain the same information.
I then ran our JMH PathMatchingBenchmark
against this PR, and it does look like it increases the operations/second, while not significantly increasing memory usage. So I am going to merge this PR for 6.0.8.