I've recently had to enable C++11 in a project because a header I use added C++11 features, and it appears that going from C++98 to C++11 makes Clang and G++ considerably slower. Can anybody else confirm this?
Did you test the --std change in isolation, without your new headers? Some libraries' headers are ridiculously expensive when they make heavy use of templates. My favorite in that regard is Boost::Qi.
How do I test it in isolation without including and making use it as before (aka no code change in the consumer of the previously C++98 header)?
Checkout the version before you introduced the C++11 header.
Alternatively, fix the header to be C++98 compatible (may of course be non-trivial).
Just compile the previous version that conforms to C++98 with different std flags and do the comparison.
Right, that makes sense. Will do, though once confirmed, I will curse C++1x even more, I guess :).
Is there a difference between -std and --std? I've always used -std=FOO.
Not surprising, since c++11 std headers are generally much larger and more complex.
This may explain it, hadn't thought of that. The header in question used C++11 atomics and therefore included a new header, which of course, due to the non-existing module system of C++ mean, means my code pulls it in as well. I know of the plans to add a module system to C++, but (1) I'm not sure it would solve this issue and require each header to have a corresponding module (2) and am skeptical of the availability and support in the field. It is much, much easier to just use Rust or OCaml, honestly, and the combination of Rust+OCaml or Rust+Haskell might be the sweet spot.