RTC Website

Summary

In this chapter, we have studied efficiency for real-time computing. The following points summarize the chapter:

  • A program’s run time is the duration of its execution. Run-time efficiency requires the minimization of this time.
  • A program’s memory usage is another important aspect of efficiency.
  • We should take care to avoid premature optimization, focusing first of all on a program’s correctness.
  • Real-time computing often requires optimization for efficiency due to its time constraints and the embeddedness of its applications.
  • Algorithmic efficiency can often be achieved by casting a computational task as an instance of a known class of problems, which have efficient solutions. An algorithm’s order of growth is expressed in big-O notation \(O()\).
  • Programmatic efficiency is programming-language specific and depends on, for example, the choices of data type for a variable, allocation of memory, and compile-time substitutions. There are many techniques that can improve the efficiency of a C program.
  • It is often necessary to test programs to determine the most efficient way to program an algorithm; the clock() function from the standard library header time.h is a simple and useful tool for such tests.
  • The C standard library header stdint.h has exact-, minimum-, and fastest minimum-width integer types that can improve efficiency.
  • In C, understanding the scoping of identifiers (variables, functions) is important for properly limiting their scope for more efficient programs. Identifiers can be declared, defined, and (their objects) initialized.
  • At times, the proper use of preprocessor macro substitutions, which take place before compilation, can increase efficiency. These macros can be function-like.
  • In C, it is important to pay close attention to operator precedence and associativity.
  • The UI functions in lab 2 require careful design for user interactions with the keypad and display.

Online Resources for Section 2.6

No online resources.