|
|
|
|
|
by hansvm
2137 days ago
|
|
The field you're looking for is superoptimization. Last I checked most of the work focused on loop-free snippets so that program length could serve as a proxy for other performance metrics. STOKE shows up frequently in those discussions, but people have tried all kinds of things ranging from genetic algorithms to neural networks to SMT solvers. To actually answer your question, compilers are pretty good, and so are expert human assemblers, but they both miss things even for short snippets. |
|
That said, compilers and superoptimizers can go together well. One of my favorite examples is using program synthesis to generate peephole optimization rules for a compiler[1]. The synthesis step takes a long time and only works for short snippets, but if you can turn the results of that into rules a compiler's optimization system can use, you only have to pay the synthesis cost once and the compiler can apply those rules to speed up large programs.
[1]: http://www.cse.iitd.ac.in/~sbansal/pubs/asplos06.pdf