Блог пользователя Sanae

Автор Sanae, история, 6 месяцев назад, По-английски

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.

  • Проголосовать: нравится
  • -33
  • Проголосовать: не нравится

»
6 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

maybe it's because copy by value vector, try reference?
I'm not sure whether that's the problem.

»
6 месяцев назад, скрыть # |
 
Проголосовать: нравится -8 Проголосовать: не нравится

One shouldn't use vectors when the size is small and fixed.

»
6 месяцев назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Why there are so many downvotes?

If you are not satisfied with my content, please express your opinion.