Skip to main content

Optimisations for Loops

  • Chapter
  • First Online:
Book cover Introduction to Compiler Design

Part of the book series: Undergraduate Topics in Computer Science ((UTICS))

  • 4054 Accesses

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–)

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Reference

  1. 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

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Torben Ægidius Mogensen .

Rights and permissions

Reprints and permissions

Copyright information

© 2017 Springer International Publishing AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics