Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 2. Coding for Performance > The Role of the Compiler

The Role of the Compiler

The purpose of the compiler is to take the source code and produce a functionally correct implementation, using only the information that the developer provides either in the source code or as part of the compilation process. It is important to recognize the constraints that the compiler is working under—something that is obvious to the developer may not be obvious to the compiler.

Most applications have execution paths that are rarely executed. A developer inspecting the code will probably be able to identify the paths that are likely to be executed infrequently. However, the compiler will be rarely able to extract additional contextual information from the source code to determine which path is most common. Consider the code shown in Listing 2.30, which has variable names that might indicate the developers’ expectations of the frequency of execution of the two code paths.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint