codec: Change buf + to buf.append for performance