when using C++ vector, time spent is 718 milliseconds, while when I use Array, time is almost 0 milliseconds.
Why so much performance difference?
int
When you declare the array, it lives in the stack (or in static memory zone), which it's very fast, but can't increase its size.
When you declare the vector, it assign dynamic memory, which it's not so fast, but is more flexible in the memory allocation, so you can change the size and not dimension it to the maximum size.