PERF: optimize inserting at end and concatenations