Real Time Systems Design And Analysis

Chapter 7.6.17 - More Optimization Techniques

7.6.17   More Optimization Techniques

A sampling of other optimization considerations follows [Jain91]. Note that
in most cases these techniques will optimize the average case, not the worst
case.

  • Optimize the common case. The most frequently used path should also be
    the most efficient. For example, arrange a series of IF statements so that the
    most likely value is tested first. Similarly, arrange a series of AND conditions
    so that the condition most likely to fail is tested first. Likewise, arrange OR
    conditions so the most likely to succeed is tested first. This technique is
    called Boolean short-circuiting.
  • Arrange entries in a table so that the most frequently sought values are the
    first to be compared (this is just a variation of the preceding).
  • Replace threshold tests on monotone (continuously nondecreasing or nonincreasing)
    functions by tests on their parameters, thereby avoiding evaluation
    of the function. For example, if exp(x) is a function computing ex, then
    instead of using

    if (exp(x) < exp(y)) then . . .


    use:

    if (x < y) then . . .

    which will save two evaluations of the costly function exp(x).
  • Link the most frequently used procedures together to maximize the locality
    of the reference (this only applies in paging or cached systems).
  • Store redundant data elements to increase the locality of reference. This
    technique only applies in paging or cached systems.
  • Store procedures in memory in sequence so that calling and called subroutines
    (procedures) will be loaded together to increase the locality of
    reference. Again, this only applies in paging or cached systems.

 

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: PCMCIA Memory Cards
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.