Optimizing strings and array allocations