On Mon, 19 Aug 2024 05:06:32 GMT, Chen Liang <li...@openjdk.org> wrote:

>> regionMatches uses vectorizedMismatch for comparison. The length of 
>> `Ljava/lang/Object;` is 18. In the code without intrinsic, it will exit 
>> after two long comparisons. If there is vector128 optimization, it will exit 
>> after one comparison, and the overhead is very small.
>
> I think you can add a case where the parameters are all these vulnerable 
> names like `Ljava/lang/Objecq;` and repeat 8 times, and see how big a 
> negative impact these close mismatches have.

The scenario of `Ljava/lang/Objecq` does not exist. I have added the following:

(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
(Ljava/lang/Integer;Ljava/lang/Integer;)Ljava/lang/Integer;


In these two scenarios, the length of `Ljava/lang/String;` is the same as that 
of `Ljava/lang/Object;`, and the length of `Ljava/lang/Integer;` is different 
from that of `Ljava/lang/Object;`, but the performance is similar. This proves 
that the performance overhead of regionMatches is very small.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20611#discussion_r1721279267

Reply via email to