Open
Description
https://godbolt.org/z/EW16jnEG7
As you can see, there is panicIndex, on s[I + j]. But in golang, for i := 0; I < len(s); I++ doesn't go into panicIndex. Why does
for i := 0; i < len(s) - len(t); i++ {
for j := 0; j < len(t); j++ {
s[i + j]
}
}
calls panicIndex? There is no need in this. Compiler sees that i + j is always in range [0, len(s)). Easy optimisation, probably not only in this case.