String indexOf Performance

Vitaly Davidovich vitalyd at gmail.com
Fri Jan 27 18:56:47 UTC 2017


IIRC, it used to be that indexOf(<constant_string>) had an intrinsic with a
fastpath, but not indexOf(char).  But it looks like java 9 has an intrinsic
for indexOf(char).

On Fri, Jan 27, 2017 at 1:43 PM, Reto Merz <reto.merz at abacus.ch> wrote:

> I have seen a big difference in 2014. Another dev has also confirmed this:
> https://sourceforge.net/p/findbugs/feature-requests/300/#cb7f
>
> In my case I have also used JITWatch to make sure that C2/HotSpot
> was really able to optimize/inline hot paths.
>
> Reto
>
>
>
> On 27.01.2017 19:37, Aleksey Shipilev wrote:
>
>> On 01/27/2017 07:22 PM, Scott Palmer wrote:
>>
>>> I looped through those 100,000 times.  I should do a proper JMH
>>> benchmark, but
>>> for now here's a link to the code:
>>>
>>>    http://pastebin.com/dWcf7rQJ
>>>
>> Ah, OK. There's no reason to dive into the performance of this particular
>> benchmark. Please isolate the behavior you are seeing with JMH, and
>> possibly see
>> the generated code with -prof perfasm (or xperfasm, since you're on
>> Windows).
>>
>> Thanks,
>> -Aleksey
>>
>>
>


More information about the jdk9-dev mailing list