4 ms·
std::list to std::vector should be the big one. std::map to std::unordered_map could be next. then, really ranges/constexpr/std::move could make a difference,
by npalli 1y ago
std::list to std::vector should be the big one.
std::map to std::unordered_map could be next.
then, really ranges/constexpr/std::move could make a difference, hard to say definitely.
Beyond these, Modern C++ would have most definitely led to much shorter code as that was a metric for comparison.
- quietbritishjim 1y ago> std::list to std::vector should be the big one That is not a "C++23 best practice", which is what I was replying to. It doesn't even need C++11! And one use of this type uses pop_front() so std::vector is not obviously a good choice here. > std::map to std::unordered_map could be next. Again, I called out C++11 as possibly making a difference - sure this could help but it doesn't need C++23. > then, really ranges/constexpr/std::move could make a difference, hard to say definitely. How? Ranges are a nice syntax but what would they speed up here? There doesn't seem to be anything evaluated at compile time so what's the benefit of constexpr? (Even std::move doesn't have an obvious use in the benchmark code but that's C++11 anyway.) > Beyond these, Modern C++ would have most definitely led to much shorter code as that was a metric for comparison. I agree that would be interesting, but I'd be surprised if the code was much shorter. I'd guess something like 10%.