Use reserve() to avoid vector reallocation.