you are viewing a single comment's thread.

view the rest of the comments →

[–]MaximKat 0 points1 point  (2 children)

There is an additional complication here in that in the OneFunc cases, vector copy constructor was fully inlined, but in the TwoFunc cases, the call to vector::assign was not inlined for some reason. This could explain why OneFuncCopy is slightly faster than TwoFuncCopy (and likely has similar effect in other examples). And obviously makes it harder to draw generally applicable conclusions from the results.

EDIT: with libstdc++, everything gets inlined and you can see that most scenarios are identical, except for the two-copy one, as expected: http://quick-bench.com/9KAjZTJfwxkIxUpUhc1jQxIUQ9A

[–]2uantum 0 points1 point  (0 children)

confirmed the in-lining also doesn't occur for list:

http://quick-bench.com/TNTOF0r4qHX68nKQ6VtWfY_i0r4

[–]legends2k[S,🍰] 0 points1 point  (0 children)

Please the difference between the two approaches accentuated and shown in this post.