Strength reduction

Strength reduction

Strength reduction is a compiler optimization where a costly operation is replaced with an equivalent, but less expensive operation.

Operator strength reduction involves using mathematical identities to replace slow math operations with faster operations. Examples of this include: replacing integer division or multiplication by a power of 2 with a shift operation, replacing integer division by a constant with reciprocal multiplication, and replacing integer multiplication by a constant with a combination of shifts, adds or subtracts. The cost and benefits will depend highly on the target CPU and sometimes on the surrounding code (depending on availability of other functional units within the CPU).

Examples:

Induction variable or recursive strength reduction replaces a function of some systematically changing variable with a simpler calculation using previous values of the function. In a procedural programming language this would apply to an expression involving a loop variable and in a declarative language it would apply to the argument of a recursive function. E.g.

f x = ... (2 ** x) ... (f (x + 1)) ...

becomes

f x = f' x (2 ** x) where f' x z = ... z ... (f' (x + 1) (2 * z)) ...

Here the expensive operation (2 ** x) has been replaced by the cheaper (2 * z) in the recursive function f'. This maintains the invariant that z = 2 ** x for any call to f'.


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Fatigue-strength reduction factor — Fatigue strength reduction factor. См. Фактор снижения усталостной прочности. (Источник: «Металлы и сплавы. Справочник.» Под редакцией Ю.П. Солнцева; НПО Профессионал , НПО Мир и семья ; Санкт Петербург, 2003 г.) …   Словарь металлургических терминов

  • Reduction — Reduction, reduced, or reduce may refer to:cienceChemistry*Reduction – chemical reaction in which atoms have their oxidation number (oxidation state) changed. **Reduced gas – a gas with a low oxidation number **Ore reduction: see… …   Wikipedia

  • Strength training — This article is about the basic principles to train muscular strength. For strength training using free weights or weight machines, see weight training. The lat. pulldown, which strengthens the arms and back Strength training is the use of… …   Wikipedia

  • Nonlinear dimensionality reduction — High dimensional data, meaning data that requires more than two or three dimensions to represent, can be difficult to interpret. One approach to simplification is to assume that the data of interest lies on an embedded non linear manifold within… …   Wikipedia

  • Noise reduction — For sound proofing, see soundproofing. For scientific aspects of noise reduction of machinery and products, see noise control. Noise reduction is the process of removing noise from a signal. All recording devices, both analogue or digital, have… …   Wikipedia

  • Helicopter noise reduction — is a topic of research into designing helicopters which can be operated more quietly, reducing the public relations problems with night flying or expanding an airport. In addition, it is useful for military applications in which stealth is… …   Wikipedia

  • LSZ reduction formula — In quantum field theory, the LSZ reduction formula is a method to calculate S matrix elements (the scattering amplitudes) from the time ordered correlation functions of a quantum field theory. It is a step of the path that starts from the… …   Wikipedia

  • Poverty Reduction and Growth Facility — The Poverty Reduction and Growth Facility (PRGF) is an arm of the International Monetary Fund which lends to the world s poorest countries. It was created in September 1999, replacing the Enhanced Structural Adjustment Facility.PRGF supported… …   Wikipedia

  • Compiler optimization — is the process of tuning the output of a compiler to minimize or maximize some attributes of an executable computer program. The most common requirement is to minimize the time taken to execute a program; a less common one is to minimize the… …   Wikipedia

  • Memoization — Not to be confused with Memorization. In computing, memoization is an optimization technique used primarily to speed up computer programs by having function calls avoid repeating the calculation of results for previously processed inputs.… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”