Fixes from Antonio. 1. I had -D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1 in the meson.build. 2. The moa_many_for test had a copy-pasta extra extra for-loop that made it slow. Fix those two and the results match expectation with auto&:for doing better than indexing.

master
Zed A. Shaw 14 hours ago
parent cc88595af8
commit b8b376d927
  1. 2
      meson.build
  2. 5
      tests/perf_tests.cpp

@ -2,7 +2,7 @@ project('sol2_test', 'cpp',
version: '0.1.0', version: '0.1.0',
default_options: [ default_options: [
'cpp_std=c++23', 'cpp_std=c++23',
'cpp_args=-D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1', # 'cpp_args=-D_GLIBCXX_DEBUG=1 -D_GLIBCXX_DEBUG_PEDANTIC=1',
]) ])
# use this for common options only for our executables # use this for common options only for our executables

@ -360,7 +360,7 @@ namespace perf_tests {
Stats moa_many_for; Stats moa_many_for;
for(int i = 0; i < sample_number; i++) { for(int i = 0; i < sample_number; i++) {
auto start = moa_many_for.time_start(); auto start = moa_many_for.time_start();
for(int i = 0; i < sample_size; i++) {
for(auto& el : moa->s1) { for(auto& el : moa->s1) {
el.a01 += el.a02 + i; el.a01 += el.a02 + i;
el.a02 += el.a03 + i; el.a02 += el.a03 + i;
@ -407,9 +407,10 @@ namespace perf_tests {
el.a18 += el.a19 + i; el.a18 += el.a19 + i;
el.a19 += el.a20 + i; el.a19 += el.a20 + i;
} }
}
moa_many_for.sample_time(start); moa_many_for.sample_time(start);
} }
moa_many_for.dump("moa many for"); moa_many_for.dump("moa many for");
fmt::println("-------------\n"); fmt::println("-------------\n");
samples.moa_many_for.push_back(moa_many_for); samples.moa_many_for.push_back(moa_many_for);

Loading…
Cancel
Save