What is the fastest portable way to copy an array in C++

Viewed 16992

This question has been bothering me for some time. The possibilities I am considering are

  1. memcpy
  2. std::copy
  3. cblas_dcopy

Does anyone have any clue on what the pros and cons are with these three? Other suggestions are also welcome.

8 Answers

I've made a small benchmark (VS 2018 Preview, MKL 2017 Update 4) to compare memcpy and the sequential version of cblas_?copy and found them to be equally fast on float and double.

Related