This! A 1000 times this!
13 karma · joined August 27, 2013
To find an index of a substring you need to scan the string, right. But once you have the byte index you can quickly jump to its position in the string, e.g. when you do a slice operation based on that index: s[i:]. If strings.Index() returned a code point index and not a byte index you would have to scan the string again.
a = s.indexOf("e̬̱ͤ̈́̿̂̅́͟")
b = s.indexOf("m̛̮̩͙ͦ͗͆̄̋́̄")
s[a:b]
This operation is fast with code unit indices and slow with code point indices.