GUDHI / gudhi-devel

The GUDHI library is a generic open source C++ library, with a Python interface, for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.
https://gudhi.inria.fr/
MIT License
246 stars 65 forks source link

fix rec_prune_above_filtration for the stable simplex handles #980

Closed hschreiber closed 9 months ago

hschreiber commented 9 months ago

Fix for Issue #979.

All options have static const bool stable_simplex_handles = true to test with github all other platforms. They need of course to be removed before merging.

hschreiber commented 9 months ago

I did one last attempt to factorize the code by letting the erase inside the if-else. And the times look better now, as the difference with the median does not exceed 3% anymore (except for very small cases) and is most of the time below 1%. But I can't say if it is still too much?

Benchmark details (v3) ```C++ bool rec_prune_above_filtration2(Siblings* sib, Filtration_value filt) { auto&& list = sib->members(); bool modified = false; bool emptied = false; Simplex_handle last; auto remove_children = [this, filt](Dit_value_t& simplex) { if (simplex.second.filtration() <= filt) return false; if (has_children(&simplex)) rec_delete(simplex.second.children()); // dimension may need to be lowered dimension_to_be_lowered_ = true; return true; }; //TODO: `if constexpr` replacable by `std::erase_if` in C++20? if constexpr (Options::stable_simplex_handles) { modified = false; for (auto sh = list.begin(); sh != list.end();) { if (remove_children(*sh)) { sh = list.erase(sh); modified = true; } else { ++sh; } } emptied = (list.empty() && sib != root()); } else { last = std::remove_if(list.begin(), list.end(), remove_children); modified = (last != list.end()); emptied = (last == list.begin() && sib != root()); } if (emptied) { // Removing the whole siblings, parent becomes a leaf. sib->oncles()->members()[sib->parent()].assign_children(sib->oncles()); delete sib; // dimension may need to be lowered dimension_to_be_lowered_ = true; return true; } else { // Keeping some elements of siblings. Remove the others, and recurse in the remaining ones. if constexpr (!Options::stable_simplex_handles) list.erase(last, list.end()); for (auto&& simplex : list) if (has_children(&simplex)) modified |= rec_prune_above_filtration(simplex.second.children(), filt); } return modified; } ``` | nber_of_points/max_dim/threshold*10 | Time ((new - old) / \|old\|) | CPU | Time Old (µs) | Time New (µs) | CPU Old (µs) | CPU New (µs) | |-------------------------------------|------------------------------|-----------|-------------------------------|---------------|--------------|--------------| | Prune_non_stable/100/6/2_pvalue | 0.0028 | 0.0028 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/100/6/2_mean | -0.0084 | -0.0083 | 47 | 47 | 47 | 47 | | Prune_non_stable/100/6/2_median | +0.0395 | +0.0395 | 45 | 47 | 45 | 46 | | Prune_non_stable/100/6/2_stddev | -0.9598 | -0.9604 | 7 | 0 | 7 | 0 | | Prune_non_stable/100/6/2_cv | -0.9595 | -0.9601 | 0 | 0 | 0 | 0 | | Prune_non_stable/256/6/2_pvalue | 0.0002 | 0.0002 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/256/6/2_mean | +0.0856 | +0.0855 | 171 | 186 | 171 | 186 | | Prune_non_stable/256/6/2_median | +0.0186 | +0.0187 | 171 | 175 | 171 | 174 | | Prune_non_stable/256/6/2_stddev | +48.4187 | +48.3892 | 1 | 36 | 1 | 36 | | Prune_non_stable/256/6/2_cv | +44.5231 | +44.4998 | 0 | 0 | 0 | 0 | | Prune_non_stable/1024/6/2_pvalue | 0.0028 | 0.0028 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/1024/6/2_mean | +0.0311 | +0.0310 | 2019 | 2082 | 2014 | 2077 | | Prune_non_stable/1024/6/2_median | +0.0340 | +0.0339 | 1896 | 1961 | 1892 | 1956 | | Prune_non_stable/1024/6/2_stddev | -0.0870 | -0.0871 | 397 | 363 | 396 | 361 | | Prune_non_stable/1024/6/2_cv | -0.1146 | -0.1145 | 0 | 0 | 0 | 0 | | Prune_non_stable/2000/6/2_pvalue | 0.0022 | 0.0022 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/2000/6/2_mean | +0.0386 | +0.0385 | 7563 | 7855 | 7547 | 7837 | | Prune_non_stable/2000/6/2_median | +0.0418 | +0.0417 | 7081 | 7377 | 7067 | 7362 | | Prune_non_stable/2000/6/2_stddev | +0.0134 | +0.0133 | 1524 | 1544 | 1516 | 1537 | | Prune_non_stable/2000/6/2_cv | -0.0243 | -0.0243 | 0 | 0 | 0 | 0 | | Prune_non_stable/100/8/2_pvalue | 0.0173 | 0.0173 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/100/8/2_mean | +0.0252 | +0.0252 | 48 | 49 | 48 | 49 | | Prune_non_stable/100/8/2_median | +0.0280 | +0.0279 | 45 | 46 | 45 | 46 | | Prune_non_stable/100/8/2_stddev | +0.0619 | +0.0620 | 6 | 7 | 6 | 7 | | Prune_non_stable/100/8/2_cv | +0.0358 | +0.0359 | 0 | 0 | 0 | 0 | | Prune_non_stable/256/8/2_pvalue | 0.0173 | 0.0173 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/256/8/2_mean | +0.0230 | +0.0230 | 180 | 184 | 179 | 183 | | Prune_non_stable/256/8/2_median | +0.0244 | +0.0244 | 168 | 173 | 168 | 172 | | Prune_non_stable/256/8/2_stddev | +0.1906 | +0.1904 | 24 | 28 | 24 | 28 | | Prune_non_stable/256/8/2_cv | +0.1639 | +0.1637 | 0 | 0 | 0 | 0 | | Prune_non_stable/1024/8/2_pvalue | 0.0173 | 0.0173 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/1024/8/2_mean | +0.0512 | +0.0512 | 2074 | 2180 | 2069 | 2175 | | Prune_non_stable/1024/8/2_median | +0.0526 | +0.0527 | 1947 | 2050 | 1943 | 2045 | | Prune_non_stable/1024/8/2_stddev | +0.4451 | +0.4448 | 287 | 415 | 286 | 413 | | Prune_non_stable/1024/8/2_cv | +0.3747 | +0.3744 | 0 | 0 | 0 | 0 | | Prune_non_stable/2000/8/2_pvalue | 0.0028 | 0.0028 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/2000/8/2_mean | -0.0090 | -0.0089 | 7445 | 7379 | 7429 | 7363 | | Prune_non_stable/2000/8/2_median | +0.0247 | +0.0247 | 7200 | 7378 | 7185 | 7362 | | Prune_non_stable/2000/8/2_stddev | -0.9852 | -0.9851 | 800 | 12 | 796 | 12 | | Prune_non_stable/2000/8/2_cv | -0.9850 | -0.9849 | 0 | 0 | 0 | 0 | | Prune_non_stable/100/10/2_pvalue | 0.0022 | 0.0022 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/100/10/2_mean | +0.0428 | +0.0427 | 48 | 50 | 47 | 50 | | Prune_non_stable/100/10/2_median | +0.0280 | +0.0279 | 45 | 47 | 45 | 47 | | Prune_non_stable/100/10/2_stddev | +0.3769 | +0.3769 | 7 | 10 | 7 | 10 | | Prune_non_stable/100/10/2_cv | +0.3204 | +0.3205 | 0 | 0 | 0 | 0 | | Prune_non_stable/256/10/2_pvalue | 0.0028 | 0.0028 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/256/10/2_mean | +0.0128 | +0.0130 | 185 | 188 | 185 | 187 | | Prune_non_stable/256/10/2_median | +0.0159 | +0.0160 | 173 | 176 | 173 | 176 | | Prune_non_stable/256/10/2_stddev | -0.1175 | -0.1174 | 37 | 32 | 36 | 32 | | Prune_non_stable/256/10/2_cv | -0.1287 | -0.1287 | 0 | 0 | 0 | 0 | | Prune_non_stable/1024/10/2_pvalue | 0.0028 | 0.0028 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/1024/10/2_mean | +0.0389 | +0.0389 | 2065 | 2145 | 2060 | 2140 | | Prune_non_stable/1024/10/2_median | +0.0392 | +0.0393 | 1938 | 2014 | 1934 | 2010 | | Prune_non_stable/1024/10/2_stddev | -0.2532 | -0.2532 | 401 | 300 | 399 | 298 | | Prune_non_stable/1024/10/2_cv | -0.2812 | -0.2812 | 0 | 0 | 0 | 0 | | Prune_non_stable/2000/10/2_pvalue | 0.0002 | 0.0002 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/2000/10/2_mean | +0.0934 | +0.0933 | 7211 | 7885 | 7196 | 7867 | | Prune_non_stable/2000/10/2_median | +0.0256 | +0.0256 | 7215 | 7400 | 7200 | 7384 | | Prune_non_stable/2000/10/2_stddev | +45.2172 | +45.3385 | 28 | 1304 | 28 | 1298 | | Prune_non_stable/2000/10/2_cv | +41.2677 | +41.3856 | 0 | 0 | 0 | 0 | | Prune_non_stable/100/6/4_pvalue | 0.0211 | 0.0211 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/100/6/4_mean | -0.0014 | -0.0014 | 54 | 54 | 54 | 54 | | Prune_non_stable/100/6/4_median | +0.0261 | +0.0260 | 50 | 51 | 50 | 51 | | Prune_non_stable/100/6/4_stddev | -0.1893 | -0.1894 | 13 | 11 | 13 | 11 | | Prune_non_stable/100/6/4_cv | -0.1882 | -0.1883 | 0 | 0 | 0 | 0 | | Prune_non_stable/256/6/4_pvalue | 0.0257 | 0.0257 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/256/6/4_mean | -0.0449 | -0.0447 | 226 | 216 | 225 | 215 | | Prune_non_stable/256/6/4_median | +0.0153 | +0.0154 | 212 | 215 | 211 | 215 | | Prune_non_stable/256/6/4_stddev | -0.9368 | -0.9368 | 33 | 2 | 33 | 2 | | Prune_non_stable/256/6/4_cv | -0.9338 | -0.9338 | 0 | 0 | 0 | 0 | | Prune_non_stable/1024/6/4_pvalue | 0.0028 | 0.0028 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/1024/6/4_mean | -0.0212 | -0.0210 | 2808 | 2749 | 2801 | 2742 | | Prune_non_stable/1024/6/4_median | -0.0064 | -0.0063 | 2637 | 2620 | 2630 | 2614 | | Prune_non_stable/1024/6/4_stddev | +0.1117 | +0.1107 | 372 | 414 | 370 | 411 | | Prune_non_stable/1024/6/4_cv | +0.1357 | +0.1346 | 0 | 0 | 0 | 0 | | Prune_non_stable/2000/6/4_pvalue | 0.3847 | 0.3847 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/2000/6/4_mean | -0.0006 | -0.0006 | 15266 | 15256 | 15226 | 15217 | | Prune_non_stable/2000/6/4_median | -0.0025 | -0.0026 | 14329 | 14293 | 14295 | 14259 | | Prune_non_stable/2000/6/4_stddev | +0.4244 | +0.4249 | 2114 | 3012 | 2103 | 2996 | | Prune_non_stable/2000/6/4_cv | +0.4253 | +0.4257 | 0 | 0 | 0 | 0 | | Prune_non_stable/100/8/4_pvalue | 0.0017 | 0.0017 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/100/8/4_mean | +0.0845 | +0.0841 | 48 | 52 | 48 | 52 | | Prune_non_stable/100/8/4_median | +0.0245 | +0.0243 | 47 | 49 | 47 | 49 | | Prune_non_stable/100/8/4_stddev | +5.8329 | +5.8541 | 1 | 7 | 1 | 7 | | Prune_non_stable/100/8/4_cv | +5.3008 | +5.3221 | 0 | 0 | 0 | 0 | | Prune_non_stable/256/8/4_pvalue | 0.0022 | 0.0022 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/256/8/4_mean | +0.0161 | +0.0161 | 224 | 227 | 223 | 227 | | Prune_non_stable/256/8/4_median | +0.0164 | +0.0165 | 212 | 216 | 212 | 215 | | Prune_non_stable/256/8/4_stddev | -0.0058 | -0.0058 | 37 | 37 | 37 | 37 | | Prune_non_stable/256/8/4_cv | -0.0215 | -0.0216 | 0 | 0 | 0 | 0 | | Prune_non_stable/1024/8/4_pvalue | 0.0211 | 0.0211 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/1024/8/4_mean | -0.0642 | -0.0639 | 3029 | 2834 | 3021 | 2828 | | Prune_non_stable/1024/8/4_median | -0.0023 | -0.0022 | 2841 | 2835 | 2835 | 2829 | | Prune_non_stable/1024/8/4_stddev | -0.9893 | -0.9894 | 571 | 6 | 568 | 6 | | Prune_non_stable/1024/8/4_cv | -0.9886 | -0.9887 | 0 | 0 | 0 | 0 | | Prune_non_stable/2000/8/4_pvalue | 0.0376 | 0.0452 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/2000/8/4_mean | +0.0026 | +0.0026 | 14894 | 14933 | 14856 | 14895 | | Prune_non_stable/2000/8/4_median | +0.0037 | +0.0037 | 13968 | 14020 | 13934 | 13986 | | Prune_non_stable/2000/8/4_stddev | -0.1037 | -0.1036 | 2841 | 2547 | 2827 | 2534 | | Prune_non_stable/2000/8/4_cv | -0.1060 | -0.1060 | 0 | 0 | 0 | 0 | | Prune_non_stable/100/10/4_pvalue | 0.0002 | 0.0002 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/100/10/4_mean | +0.0879 | +0.0877 | 52 | 56 | 52 | 56 | | Prune_non_stable/100/10/4_median | +0.0221 | +0.0220 | 52 | 53 | 52 | 53 | | Prune_non_stable/100/10/4_stddev | +137.9761 | +146.3052 | 0 | 11 | 0 | 11 | | Prune_non_stable/100/10/4_cv | +126.7444 | +134.4226 | 0 | 0 | 0 | 0 | | Prune_non_stable/256/10/4_pvalue | 0.0028 | 0.0028 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/256/10/4_mean | +0.0075 | +0.0076 | 229 | 230 | 228 | 230 | | Prune_non_stable/256/10/4_median | +0.0132 | +0.0133 | 213 | 216 | 213 | 216 | | Prune_non_stable/256/10/4_stddev | -0.2386 | -0.2390 | 49 | 37 | 49 | 37 | | Prune_non_stable/256/10/4_cv | -0.2443 | -0.2447 | 0 | 0 | 0 | 0 | | Prune_non_stable/1024/10/4_pvalue | 0.0028 | 0.0028 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/1024/10/4_mean | +0.0178 | +0.0182 | 2956 | 3008 | 2947 | 3001 | | Prune_non_stable/1024/10/4_median | +0.0179 | +0.0183 | 2776 | 2825 | 2768 | 2819 | | Prune_non_stable/1024/10/4_stddev | -0.3100 | -0.3110 | 567 | 391 | 565 | 389 | | Prune_non_stable/1024/10/4_cv | -0.3221 | -0.3233 | 0 | 0 | 0 | 0 | | Prune_non_stable/2000/10/4_pvalue | 0.3447 | 0.3447 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/2000/10/4_mean | -0.0338 | -0.0332 | 14230 | 13750 | 14187 | 13716 | | Prune_non_stable/2000/10/4_median | +0.0063 | +0.0069 | 13308 | 13392 | 13269 | 13360 | | Prune_non_stable/2000/10/4_stddev | -0.5815 | -0.5820 | 2752 | 1152 | 2741 | 1145 | | Prune_non_stable/2000/10/4_cv | -0.5669 | -0.5677 | 0 | 0 | 0 | 0 | | Prune_non_stable/100/6/6_pvalue | 0.0008 | 0.0006 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/100/6/6_mean | +0.0764 | +0.0763 | 59 | 64 | 59 | 64 | | Prune_non_stable/100/6/6_median | +0.0209 | +0.0209 | 59 | 60 | 59 | 60 | | Prune_non_stable/100/6/6_stddev | +24.2973 | +24.7817 | 0 | 11 | 0 | 11 | | Prune_non_stable/100/6/6_cv | +22.5013 | +22.9541 | 0 | 0 | 0 | 0 | | Prune_non_stable/256/6/6_pvalue | 0.0211 | 0.0211 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/256/6/6_mean | +0.0033 | +0.0037 | 288 | 289 | 288 | 289 | | Prune_non_stable/256/6/6_median | +0.0094 | +0.0096 | 269 | 272 | 268 | 271 | | Prune_non_stable/256/6/6_stddev | -0.0609 | -0.0621 | 60 | 56 | 60 | 56 | | Prune_non_stable/256/6/6_cv | -0.0640 | -0.0655 | 0 | 0 | 0 | 0 | | Prune_non_stable/1024/6/6_pvalue | 0.3075 | 0.2730 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/1024/6/6_mean | +0.0049 | +0.0067 | 6797 | 6831 | 6767 | 6812 | | Prune_non_stable/1024/6/6_median | +0.0107 | +0.0109 | 6348 | 6416 | 6330 | 6399 | | Prune_non_stable/1024/6/6_stddev | +0.0286 | +0.0322 | 1301 | 1338 | 1289 | 1331 | | Prune_non_stable/1024/6/6_cv | +0.0236 | +0.0253 | 0 | 0 | 0 | 0 | | Prune_non_stable/2000/6/6_pvalue | 0.8501 | 1.0000 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/2000/6/6_mean | -0.0481 | -0.0480 | 176277 | 167798 | 175873 | 167437 | | Prune_non_stable/2000/6/6_median | +0.0035 | +0.0035 | 166993 | 167573 | 166648 | 167232 | | Prune_non_stable/2000/6/6_stddev | -0.9227 | -0.9222 | 23318 | 1803 | 23194 | 1804 | | Prune_non_stable/2000/6/6_cv | -0.9188 | -0.9183 | 0 | 0 | 0 | 0 | | Prune_non_stable/100/8/6_pvalue | 0.0140 | 0.0140 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/100/8/6_mean | +0.0180 | +0.0177 | 66 | 67 | 66 | 67 | | Prune_non_stable/100/8/6_median | +0.0199 | +0.0196 | 62 | 63 | 61 | 63 | | Prune_non_stable/100/8/6_stddev | -0.0086 | -0.0088 | 10 | 10 | 10 | 10 | | Prune_non_stable/100/8/6_cv | -0.0261 | -0.0260 | 0 | 0 | 0 | 0 | | Prune_non_stable/256/8/6_pvalue | 0.0002 | 0.0002 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/256/8/6_mean | +0.0765 | +0.0762 | 273 | 294 | 272 | 293 | | Prune_non_stable/256/8/6_median | +0.0114 | +0.0113 | 273 | 276 | 272 | 275 | | Prune_non_stable/256/8/6_stddev | +131.8829 | +132.7731 | 0 | 57 | 0 | 57 | | Prune_non_stable/256/8/6_cv | +122.4423 | +123.3026 | 0 | 0 | 0 | 0 | | Prune_non_stable/1024/8/6_pvalue | 0.0173 | 0.0173 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/1024/8/6_mean | +0.0155 | +0.0152 | 9179 | 9321 | 9156 | 9295 | | Prune_non_stable/1024/8/6_median | +0.0162 | +0.0159 | 8607 | 8746 | 8587 | 8724 | | Prune_non_stable/1024/8/6_stddev | +0.3326 | +0.3324 | 1374 | 1831 | 1367 | 1822 | | Prune_non_stable/1024/8/6_cv | +0.3123 | +0.3124 | 0 | 0 | 0 | 0 | | Prune_non_stable/2000/8/6_pvalue | 0.0257 | 0.0257 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/2000/8/6_mean | +0.0241 | +0.0239 | 214412 | 219588 | 213984 | 219105 | | Prune_non_stable/2000/8/6_median | +0.0231 | +0.0230 | 214523 | 219482 | 214077 | 219005 | | Prune_non_stable/2000/8/6_stddev | +12.0707 | +12.0689 | 1337 | 17476 | 1334 | 17440 | | Prune_non_stable/2000/8/6_cv | +11.7625 | +11.7634 | 0 | 0 | 0 | 0 | | Prune_non_stable/100/10/6_pvalue | 0.0028 | 0.0028 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/100/10/6_mean | +0.0259 | +0.0256 | 63 | 64 | 63 | 64 | | Prune_non_stable/100/10/6_median | +0.0278 | +0.0275 | 59 | 61 | 59 | 60 | | Prune_non_stable/100/10/6_stddev | -0.3201 | -0.3202 | 12 | 8 | 12 | 8 | | Prune_non_stable/100/10/6_cv | -0.3373 | -0.3371 | 0 | 0 | 0 | 0 | | Prune_non_stable/256/10/6_pvalue | 0.6232 | 0.5205 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/256/10/6_mean | -0.0023 | -0.0019 | 287 | 286 | 286 | 286 | | Prune_non_stable/256/10/6_median | +0.0002 | +0.0005 | 269 | 269 | 268 | 268 | | Prune_non_stable/256/10/6_stddev | +0.1439 | +0.1439 | 37 | 43 | 37 | 42 | | Prune_non_stable/256/10/6_cv | +0.1465 | +0.1460 | 0 | 0 | 0 | 0 | | Prune_non_stable/1024/10/6_pvalue | 0.0376 | 0.0376 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/1024/10/6_mean | -0.0037 | -0.0039 | 8651 | 8619 | 8629 | 8596 | | Prune_non_stable/1024/10/6_median | -0.0045 | -0.0046 | 8118 | 8081 | 8098 | 8061 | | Prune_non_stable/1024/10/6_stddev | -0.0627 | -0.0623 | 1216 | 1139 | 1209 | 1134 | | Prune_non_stable/1024/10/6_cv | -0.0592 | -0.0586 | 0 | 0 | 0 | 0 | | Prune_non_stable/2000/10/6_pvalue | 0.1212 | 0.1212 | U Test, Repetitions: 10 vs 10 | | | | | Prune_non_stable/2000/10/6_mean | -0.0369 | -0.0368 | 366450 | 352929 | 365593 | 352124 | | Prune_non_stable/2000/10/6_median | -0.0073 | -0.0074 | 346320 | 343798 | 345583 | 343037 | | Prune_non_stable/2000/10/6_stddev | -0.3289 | -0.3291 | 44736 | 30022 | 44489 | 29848 | | Prune_non_stable/2000/10/6_cv | -0.3032 | -0.3034 | 0 | 0 | 0 | 0 | | OVERALL_GEOMEAN | +0.0167 | +0.0168 | 0 | 0 | 0 | 0 |
mglisse commented 9 months ago

This v3 should in principle generate the same code as master for flat_map, the difference in the benchmark is probably noise. My hope was to replace if constexpr with erase_if, if we cannot do that and have to keep quite a bit of if constexpr, my motivation reduces. Still, the v3 looks ok if you like that version. You could mention in the comment about erase_if that it does have a runtime cost, so we remember that it may not be such a good idea.