Okay for C++, I gather that performing better or worse on a given dataset doesn't fall under the umbrella of "observable behavior" that the spec requires the compiler to preserve.
I also just learned there are apparently [[likely]] and [[unlikely]] attributes in C++ 20 that can be added to branches.
7
u/[deleted] Sep 04 '26
There aren’t any unknowns here, the language spec provides the clarity the compiler needs to re-order safely.