3 ms·
It would be an interesting project to take in some (small) source program, and try all sorts of algebraic rearrangements (maybe just associativity and commutati
by harpocrates 10y ago
It would be an interesting project to take in some (small) source program, and try all sorts of algebraic rearrangements (maybe just associativity and commutativity of addition and multiplication) to see if there is any noticeable performance change.
- matt_d 10y agoSTOKE, a stochastic superoptimizer, is pretty interesting in this context: http://stoke.stanford.edu/ http://stoke.stanford.edu/ & https://github.com/StanfordPL/stoke https://github.com/StanfordPL/stoke
- dspig 10y agothe performance definitely varies doing this by hand - I guess the current optimizers don't rearrange the code as much as a human can while seeing that it's still equivalent. But sometimes (I'm using LLVM) just rearranging the parentheses to force a different evaluation order makes a difference where I thought it wouldn't have after optimization.