Hello There are double strlen() invocations in getstrvalue(). It's not about negative indexes – although they have been optimized too – but about dupstring() and v->end, v->start verification code at the end. Actually a single strlen() call is required. Attached test script runs 1765 ms for optimized Zsh, 1980 ms for no optimizations (minimum obtainable times): strtest() { a="" i=$(( 4000 )) while (( i -- )); do a+="a${a[1,200]}" done } I've used signed size variable but the code did that already. More optimization is possible – dupstring() could do strncpy(), copy only requested number of bytes, e.g. first 200 out of 10000, but the trailing \0 nuances made me wait with this change. -- Sebastian Gniazdowski psprint@fastmail.com