optimize for merge array