Re: String.indexOf(single-char-String)

2021-11-27 Thread Michael Bien
StringIndexOfChar showed that the assumption that the char variant should be at least as fast as the String variant doesn't always apply. The implementation for indexOf(char) seems to have a different code emission heuristics than the String variant.

Re: String.indexOf(single-char-String)

2021-11-26 Thread Michael Bien
added benchmark results for OpenJDK's StringIndexOf benchmark: https://github.com/openjdk/jdk/pull/6509#issuecomment-979985594 -michael On 25.11.21 15:05, Michael Bien wrote: Hello again, I was trying to run JDK's benchmarks over night (second attempt actually) but had some difficulties to

Re: String.indexOf(single-char-String)

2021-11-25 Thread Michael Bien
Hello again, I was trying to run JDK's benchmarks over night (second attempt actually) but had some difficulties to get stable results. This makes it difficult to compare the modified version with a reference. I am not sure what the cause is, I have heard some intel CPUs can't run avx

Re: String.indexOf(single-char-String)

2021-11-23 Thread Michael Bien
On 23.11.21 15:57, Roger Riggs wrote: Hi Michael, As you might expect performance of strings is very sensitive and has been tuned extensively over the years many times. Though this improves the performance for 1 character strings. It will have an impact on *every other* length of string.

Re: String.indexOf(single-char-String)

2021-11-23 Thread Roger Riggs
Hi Michael, As you might expect performance of strings is very sensitive and has been tuned extensively over the years many times. Though this improves the performance for 1 character strings. It will have an impact on *every other* length of string. You'll need to show that it does not

String.indexOf(single-char-String)

2021-11-22 Thread Michael Bien
Hello, I kept forgetting which variants of the String methods perform better with single-char-Strings and which with char (IDEs had the tendency to suggest the wrong variant since it changed between JDK releases). So i wrote JMH benchmarks and noticed that the last method with a performance