Abstract
Since programs tend to spend most of their time in loops, it is worthwhile to study optimisations specific for loops. We will in this chapter look at three specific optimisations for loops: Code hoisting , which moves loop-invariant code out of a loop, memory prefetching , which improves cache utilisation, and incrementalisation , which replaces multiplication in a loop by addition.
If you optimize everything, you will always be unhappy.
Donald Knuth (1938–)
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Reference
Liu, Y.A.: Efficiency by incrementalization: An introduction. Higher Order Symbol. Comput. 13, 289–313 (2000). doi:10.1023/A:1026547031739. http://dl.acm.org/citation.cfm?id=369129.369135
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
Copyright information
© 2017 Springer International Publishing AG
About this chapter
Cite this chapter
Mogensen, T. (2017). Optimisations for Loops. In: Introduction to Compiler Design. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-319-66966-3_11
Download citation
DOI: https://doi.org/10.1007/978-3-319-66966-3_11
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-66965-6
Online ISBN: 978-3-319-66966-3
eBook Packages: Computer ScienceComputer Science (R0)