https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92546
--- Comment #29 from Jonathan Wakely <redi at gcc dot gnu.org> --- Avoiding <functional> makes a big difference: $ : | g++-11 -std=gnu++17 -P -E -x c++ - -include algorithm | wc -l 27018 $ : | g++-11 -std=gnu++17 -P -E -x c++ - -include algorithm | wc -l 25188 $ : | g++-12 -std=gnu++17 -P -E -x c++ - -include algorithm | wc -l 12268 $ : | g++-11 -std=gnu++20 -P -E -x c++ - -include algorithm | wc -l 45780 $ : | g++-11 -std=gnu++20 -P -E -x c++ - -include algorithm | wc -l 42404 $ : | g++-12 -std=gnu++20 -P -E -x c++ - -include algorithm | wc -l 20918 Improvements still to be done (in stage 1): - Replace std::vector in <functional> (comment 19) - Replace std::vector in <memory_resource> - Reduce PSTL includes (comment 27)