2 ms·
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 e
by mikeash 11y ago
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.
- evincarofautumn 11y agoThat 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.