Some constant factor difference between vector and array

Revision en1, by Sanae, 2025-10-28 03:49:12

Code with Vector

Code with Array

Observation

Based on my testing, arrays are significantly faster than vectors in this scenario—specifically, around 14 to 15 times faster.

Revelation

For parameter lists with fixed lengths, use arrays for better performance. When dealing with dynamic lengths, vectors are more efficient for faster coding. However, performance can still be optimized using pointers in either case.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English Sanae 2025-10-28 03:49:12 614 Initial revision (published)