Hello, there's freearray() at end of setarrvalue(). It can be replaced with free() if ownership of all strings will be given away: for (r = val; *r;) *p++ = ztrdup(*r++); becomes: for (r = val; *r;) *p++ = *r++; and freearray(val) -> free(val). It is very provable that this is correct: `val` must have data of the same kind as ztrdup() produces, as it is simply passed to freearray(), where zsfree() is called on each string. Test function: test_fun() { local -a arr arr=( "a" ) repeat 20; do arr+=( $arr ) done } Runs 2189 ms when no optimization, 1653 ms when optimized (when ran 3 times, test script attached). This is a mild optimization as most often short arrays are being assigned, not long like in the test function, but still, this can save one's day in certain situations. -- Sebastian Gniazdowski psprint@fastmail.com