After a bit of testing, I found out that my block runs into an infinite loop if you're searching for a single character, and that character is at the end. I fixed it by allowing the substring block to report an empty string if the start index is greater than the length of the string.
(I attach the reporter version of duration (Dardoro), with some improvements: run the script x times, report the average duration and also report the result)
It's a very big string: 489000 char
on my computer, your block (non-overlapping) run in 650ms
on my computer, bh block (overlapping) run in 2790ms
Do you wanna try to beat bh speed with the overtapping version ?