Efficient C

Thomas Plum, Jim Brodie

Publisher: Plum Hall, 1985, 157 pages

ISBN: 0-911537-05-8

Keywords: Programming

Last modified: March 20, 2022, 11:37 p.m.

This book provides a small suite of C functions into which the reader can "plug in" any C statement and determine how many microseconds of CPU time it takes to execute. Expanding upon this technique, the book presents tables of CPU time and code space for C operators, control structures, and function calls. These allow the reader to make fairly accurate estimates of the resources that a program will take, without resorting to assembler listings.

The book discusses optimization techniques performed automatically by several compilers, as well as those techniques which can be effectively used by the programmer. Throughout the book, emphasis is placed upon techniques which are both efficient and portable.

  1. Introduction
    1. Why A Book on C Efficiency
    2. Overview of the Book
  2. A Simple Example
    1. Representative Environments
    2. An Example
    3. Some Caveats to the Reader
  3. Measuring Time
    1. Cycle Counting
    2. Timing Executing Programs
    3. Timing Parts of a Program
    4. Looking At the Details
    5. Applying the Timing Results
    6. Control Structures
    7. Function Calls and returns
    8. Libraries
    9. Summary
  4. General Efficiency Techniques
    1. Advance Estimates of Time
    2. What About "First, Make It Right"?
    3. A Qualified "Make It Right" Rule
    4. When and How To Estimate
    5. Additional benefits from Estimation
    6. Compiler Options
    7. Design and Coding Techniques
  5. Efficient Coding in C
    1. Compiler Optimizations
    2. Selecting Data Types for Speed
    3. Using the Register Storage Class
    4. Efficient Loops
    5. Macros vs. Functions
    6. Subscripts and Pointers
    7. Profiling an Executable Program
    8. Unfounded Efficiency myths
    9. Last Resort Techniques
  6. Measuring Space
    1. When Is Space Important
    2. Memory and a C Program
    3. Measuring program Space Requirements
    4. Measuring Dynamic Memory Requirements
  7. Estimation of Space requirements
    1. Text Estimation
    2. Static Data Estimation
    3. Dynamic Memory Estimation
    4. Total Space Estimation
  8. Improving Space Efficiency
    1. Using Register Variables
    2. Using Small Data Types
    3. Bit Packing
    4. Unions
    5. Array vs. Linked Data Structures
    6. Dynamic vs. Static Allocation
    7. Controlling the Growth of the Stack
    8. Using a Function to Represent Data
  9. Translation into C
    1. The detab program
    2. The ctoi Function
    3. Summary
  • Appendix

Reviews

Efficient C

Reviewed by Roland Buresund

OK ***** (5 out of 10)

Last modified: May 21, 2007, 3 a.m.

Ah, the good ole days, when the debate where wether int or short variables had the fastest execution times in compiler X. Should be read by programmers today.

Comments

There are currently no comments

New Comment

required

required (not published)

optional

required

captcha

required