News for hackers. Stuff that matters.
Re:Compiler Optimizations are Awesome by openasocket on Thursday June 01, 2017 @11:24AM (#14461030)
I mean that's basically constant folding on steroids, in this case taking advantage of the fact it knows the array has three elements, and that we only care about entry 1. Which is impressive, really impressive, but it is fundamentally limited. This approach won't ever be able to take your bubble sort implementation and turn it into a quick sort or merge sort. In general I don't think this sort of optimization will lead to asymptotic improvements in runtime, excluding certain edge cases.

Which isn't to say these optimizations aren't important and can lead to very real improvements in speed, I just wouldn't consider it algorithm rewriting in the strictest sense.

Re:Compiler Optimizations are Awesome by AstralStorm on Friday June 02, 2017 @03:07AM (#14468047)
The only way to automatically replace nontrivial algorithms safely to provide a formal proof of each one then do a library match.