Re:Std: Clamp generates less efficient assembly than std:min...
by josephg on Tuesday January 16, 2024 @09:20AM
(#39013490)
Yep. Adding "-C target-cpu=native" to rustc on my desktop computer consistently gets a ~10-15% performance boost compared to the default target. The default target is extremely conservative. As far as I can tell, it doesn't take advantage of any CPU features added in the last 20 years. (The k8 came out in 2003.)
Re:Std: Clamp generates less efficient assembly than std:min...
by wongarsu on Tuesday January 16, 2024 @09:54AM
(#39013885)
Red Hat Enterprise Linux has upgraded their default target to x86-64-v2 and is considering switching to x86-64-v3 for RHEL 10 (which should release around 2026?). I'd take that as a sign that those might be reasonable choices for newly released software.
Some linux distros also give you the option to either get a version compatible with ancient hardware or the optimized x86-64-v3 version, which seems like a good compromise.
Re:Std: Clamp generates less efficient assembly than std:min...
by jeffbee on Tuesday January 16, 2024 @09:28AM
(#39013577)
Those Gentoo people were onto something.
Re:Std: Clamp generates less efficient assembly than std:min...
by alexey-salmin on Tuesday January 16, 2024 @10:01AM
(#39013971)
Funny that it stopped being the case for a while around 2006. AMD64 became widespread while also being very new, closing the gap between "default" and "native".
Re:Std: Clamp generates less efficient assembly than std:min...
by skykooler on Tuesday January 16, 2024 @02:01PM
(#39017351)
Of course, gentoo just started using prebuilt packages a few months ago…
Always specify your target.