On Wed, 17 May 2023 05:24:28 GMT, Stuart Marks <sma...@openjdk.org> wrote:

>> Raffaello Giulietti has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Added some randomness in tests.
>
> src/java.base/share/classes/java/util/regex/Matcher.java line 271:
> 
>> 269:         return text instanceof String s ? s : text.subSequence(first, 
>> last).toString();
>> 270:     }
>> 271: 
> 
> I'd think we'd want to get a subSequence of any text, regardless of whether 
> it's a String or some other CharSequence. This could result in a savings if 
> there is a match result (or several match results) from find() operation(s) 
> on a large String, when the matched text is relative small.
> 
> I'd also merge this into the creation of the MatchResult. The offset needs to 
> be stored because the start/end locations are indexes into the original text, 
> but we're storing only a subSequence of the original text. However, if we 
> always store a subSequence, the offset is always the same as `first`.

Done.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13231#discussion_r1196197916

Reply via email to