and std_swap_ranges/9000 made me curious. It is big for me too. Looks like the main reason is vector ...">

Provide an intentional (mis)alignment that corresponds to typical usage in benchmarks for plain arrays · Issue #5035 · microsoft/STL (original) (raw)

Results on my 5950X:

A big difference in "After" columnbetween std_swap<9000, uint8_t> and std_swap_ranges<uint8_t>/9000 made me curious. It is big for me too.

Looks like the main reason is vector over-alignment. adding alignas(64) to stack array makes significant improvement there.

I don't think the benchmark should be modified to have that though.

If we know that alignment has a significant effect on the results, shouldn't we control it instead of letting it vary and skew the benchmark? Note that "control" doesn't mean "pick an unrealistic value that skews the results" but either pick a value that is representative or average over a set of values that are representative.

Originally posted by @CaseyCarter in #4991 (comment)