News for hackers. Stuff that matters.
Re:Random Acts of Optimization by mikeash on Thursday October 29, 2015 @05:08PM (#10474296)
I wonder if it would be practical to expose the optimizations to the programmer and allow the complex ones that are easy to accidentally disable to be invoked explicitly. Your code would look something like:

    optimization(fold_constant_vector_lookup_access_frobnitz) {
        complex code here
    }
And if the compiler can't apply the optimization, it can produce an error rather than slow code.
Re:Random Acts of Optimization by evincarofautumn on Thursday October 29, 2015 @05:30PM (#10474463)
That works. We already have some things like that, like “__attribute__((always_inline))”. Of course, forcing some optimisations could implicitly prevent others, but that’d also be true if you did it manually.

With expressive enough metaprogramming, you could also do some of these explicit optimisations in user code.