diff --git a/examples/viewcopy/viewcopy.cpp b/examples/viewcopy/viewcopy.cpp index e1f6b60071..61fac71892 100644 --- a/examples/viewcopy/viewcopy.cpp +++ b/examples/viewcopy/viewcopy.cpp @@ -436,9 +436,9 @@ try std::ofstream plotFile{"viewcopy.tsv"}; plotFile.exceptions(std::ios::badbit | std::ios::failbit); - plotFile - << "\"\"\t\"memcpy\"\t\"memcpy(p)\"\t\"memcpy\\\\\\_avx2\"\t\"memcpy\\\\\\_avx2(p)\"\t\"naive copy\"\t\"naive " - "copy(p)\"\t\"std::copy\"\t\"aosoa copy(r)\"\t\"aosoa copy(w)\"\t\"aosoa copy(r,p)\"\t\"aosoa copy(w,p)\"\n"; + plotFile << "\"\"\t\"memcpy\"\t\"memcpy\\\\\\_avx2\"\t\"memcpy(p)\"\t\"memcpy\\\\\\_avx2(p)\"\t\"naive " + "copy\"\t\"std::copy\"\t\"aosoa copy(r)\"\t\"aosoa copy(w)\"\t\"naive copy(p)\"\t\"aosoa " + "copy(r,p)\"\t\"aosoa copy(w,p)\"\n"; std::vector> src(dataSize); @@ -457,10 +457,10 @@ try std::cout << "byte[] -> byte[]\n"; plotFile << "\"byte[] -> byte[]\"\t"; benchmarkMemcpy("memcpy", std::memcpy); + benchmarkMemcpy("memcpy_avx2", memcpy_avx2); benchmarkMemcpy( "memcpy(p)", [&](auto* dst, auto* src, auto size) { parallel_memcpy(dst, src, size, std::memcpy, numThreads); }); - benchmarkMemcpy("memcpy_avx2", memcpy_avx2); benchmarkMemcpy( "memcpy_avx2(p)", [&](auto* dst, auto* src, auto size) { parallel_memcpy(dst, src, size, memcpy_avx2, numThreads); }); @@ -498,11 +498,9 @@ try plotFile << "0\t"; plotFile << "0\t"; benchmarkCopy("naive copy", [](const auto& srcView, auto& dstView) { naive_copy(srcView, dstView); }); - benchmarkCopy( - "naive copy(p)", - [&](const auto& srcView, auto& dstView) { naive_copy(srcView, dstView, numThreads); }); benchmarkCopy("std::copy", [](const auto& srcView, auto& dstView) { std_copy(srcView, dstView); }); - if constexpr (is_AoSoA || is_AoSoA) + constexpr auto oneIsAoSoA = is_AoSoA || is_AoSoA; + if constexpr (oneIsAoSoA) { benchmarkCopy( "aosoa copy(r)", @@ -510,6 +508,17 @@ try benchmarkCopy( "aosoa copy(w)", [](const auto& srcView, auto& dstView) { aosoa_copy(srcView, dstView); }); + } + else + { + plotFile << "0\t"; + plotFile << "0\t"; + } + benchmarkCopy( + "naive copy(p)", + [&](const auto& srcView, auto& dstView) { naive_copy(srcView, dstView, numThreads); }); + if constexpr (oneIsAoSoA) + { benchmarkCopy( "aosoa_copy(r,p)", [&](const auto& srcView, auto& dstView) { aosoa_copy(srcView, dstView, numThreads); }); @@ -521,8 +530,6 @@ try { plotFile << "0\t"; plotFile << "0\t"; - plotFile << "0\t"; - plotFile << "0\t"; } plotFile << "\n"; };