I think it’s not unusual for any program to be 30% faster than the program it replaces. So far I haven’t seen any specific examples of the C++ or Rust compiler providing a speedup by leveraging additional information input by the programmer. The main speedup seems to be the ability to easily implement more complicated algorithms, and the ability to speedily replace slow one-off implementations with relatively high-quality standard library ones.
Yes, the practicality of dropping in use of a well-optimized library is one of the ways that C++ code often beats C.
Another is the ability to pass a lambda to library function, and compiled directly into it, where C would need to pass a pointer-to-function to be called indirectly.
Both contribute to the showcase sorting example, which is used frequently because it had proven to be understandable, not because it is unique.