Adaptive optimization: Difference between revisions

Content deleted Content added
Added {{primary sources}} and {{ref improve}} tags to article (TW)
mNo edit summary
 
(15 intermediate revisions by 10 users not shown)
Line 1:
{{Multiple issues|
{{primary sources|date=August 2012}}
{{refPrimary improvesources|date=August 2012}}
{{primary sourcesRefimprove|date=August 2012}}
'''Adaptive optimization''' is a technique in [[computer science]] that performs [[dynamic recompilation]] of portions of a [[computer program|program]] based on the current execution profile. With a simple implementation, an adaptive optimizer may simply make a trade-off between [[Just-in-time compilation]] and interpreting instructions. At another level, adaptive optimization may take advantage of local data conditions to optimize away branches and to use [[inline expansion]] to decrease [[context switch]]ing.
}}
'''Adaptive optimization''' is a technique in [[computer science]] that performs [[dynamic recompilation]] of portions of a [[computer program|program]] based on the current execution profile. With a simple implementation, an adaptive optimizer may simply make a trade-off between [[Justjust-in-time compilation]] and [[interpreted language|interpreting instructions]]. At another level, adaptive optimization may take advantage of local data conditions to optimize away branches and to use [[inline expansion]] to decrease [[contextthe switch]]ingcost of procedure calls.
 
Consider a hypothetical banking application that handles transactions one after another. These transactions may be checks, deposits, and a large number of more obscure transactions. When the program executes, the actual data may consist of clearing tens of thousands of checks without processing a single deposit and without processing a single check with a fraudulent account number. An adaptive optimizer would compile assembly code to optimize for this common case. If the system then started processing tens of thousands of deposits instead, the adaptive optimizer would recompile the assembly code to optimize the new common case. This optimization may include inlining code or moving error processing code to secondary cache.
 
*Examples of adaptive optimization include [[HotSpot (virtual machine)|HotSpot]] and HP's [[Dynamo systemproject|Dynamo system]].<ref>[httphttps://arstechnica.com/reviews/1q00/dynamo/dynamo-1.html HP's Dynamo]</ref>
==Examples==
* [[Hotspot]] [[Java performance#Adaptive optimization|Adaptive optimization in Java]]
* HP's Dynamo system <ref>[http://arstechnica.com/reviews/1q00/dynamo/dynamo-1.html HP's Dynamo]</ref>
 
In some systems, notably the [[Java virtual machine|Java Virtual Machine]]{{Citation needed|date=June 2011}}, execution over a range of [[Java bytecode|bytecode instructions]] can be [[Reversible_computing|provably reversed.]] This allows an adaptive optimizer to make risky assumptions about the code. In the above example, the optimizer may assume all transactions are checks and all account numbers are valid. When these assumptions prove incorrect, the adaptive optimizer can 'unwind' to a valid state and then interpret the byte code instructions correctly.
==Deoptimization==
In some systems, notably the [[Java Virtual Machine]]{{Citation needed|date=June 2011}}, execution over a range of [[Java bytecode|bytecode instructions]] can be provably reversed. This allows an adaptive optimizer to make risky assumptions about the code. In the above example, the optimizer may assume all transactions are checks and all account numbers are valid. When these assumptions prove incorrect, the adaptive optimizer can 'unwind' to a valid state and then interpret the byte code instructions correctly.
 
==See also==
{{Portal|Computer programming}}
* [[Profile-guided optimization]]
* [[Hot spot (computer programming)]]
 
==References==
Line 19 ⟶ 20:
 
==External links==
* [http://citeseer.ist.psu.edu/arnold00adaptive.html CiteSeer for "Adaptive Optimization in the Jalapeño JVM (2000)"] by Matthew Arnold, Stephen Fink, David Grove, Michael Hind, Peter F. Sweeney. Contains links to the full paper in various formats.
 
{{Comp-sci-stub}}
 
[[Category:Compiler optimizations]]
 
[[ar:أمثلة متكيفة]]
[[de:Dynamische Optimierung]]
[[it:Ottimizzazione adattativa]]