1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
|
<!doctype html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta http-equiv="content-style-type" content="text/css">
<link rel="stylesheet" type="text/css" href="style.css">
<title>Optimizations</title>
</head>
<body>
<h2>Optimizations</h2>
The optimization step of ProGuard can be switched off with the
<a href="usage.html#dontoptimize"><code>-dontoptimize</code></a> option. For
more fine-grained control over individual optimizations, experts can use the
<a href="usage.html#optimizations"><code>-optimizations</code></a> option,
with a filter based on the optimization names listed below. The filter works
like any <a href="usage.html#filters">filter</a> in ProGuard.
<p>
The following wildcards are supported:
<table cellspacing="10">
<tr><td valign="top"><code><b>?</b></code></td>
<td>matches any single character in an optimization name.</td></tr>
<tr><td valign="top"><code><b>*</b></code></td>
<td>matches any part of an optimization name.</td></tr>
</table>
An optimization that is preceded by an exclamation mark '<b>!</b>' is
<i>excluded</i> from further attempts to match with <i>subsequent</i>
optimization names in the filter. Make sure to specify filters correctly,
since they are not checked for potential typos.
<p>
For example,
"<code>code/simplification/variable,code/simplification/arithmetic</code>"
only performs the two specified peephole optimizations.
<p>
For example, "<code>!method/propagation/*</code>" performs all optimizations,
except the ones that propagate values between methods.
<p>
For example,
"<code>!code/simplification/advanced,code/simplification/*</code>" only
performs all peephole optimizations.
<p>
Some optimizations necessarily imply other optimizations. These are then
indicated. Note that the list is likely to change over time, as optimizations
are added and reorganized.
<p>
<dl>
<dt><code><b>class/marking/final</b></code></dt>
<dd>Marks classes as final, whenever possible.</dd>
<dt><code><b>class/merging/vertical</b></code></dt>
<dd>Merges classes vertically in the class hierarchy, whenever possible.</dd>
<dt><code><b>class/merging/horizontal</b></code></dt>
<dd>Merges classes horizontally in the class hierarchy, whenever possible.</dd>
<dt><div>(⇒ <code>code/removal/advanced</code>)</div>
<code><b>field/removal/writeonly</b></code></dt>
<dd>Removes write-only fields.</dd>
<dt><code><b>field/marking/private</b></code></dt>
<dd>Marks fields as private, whenever possible.</dd>
<dt><div>(⇒ <code>code/simplification/advanced</code>)</div>
<code><b>field/propagation/value</b></code></dt>
<dd>Propagates the values of fields across methods.</dd>
<dt><code><b>method/marking/private</b></code></dt>
<dd>Marks methods as private, whenever possible (<i>devirtualization</i>).</dd>
<dt><div>(⇒ <code>code/removal/advanced</code>)</div>
<code><b>method/marking/static</b></code></dt>
<dd>Marks methods as static, whenever possible (<i>devirtualization</i>).</dd>
<dt><code><b>method/marking/final</b></code></dt>
<dd>Marks methods as final, whenever possible.</dd>
<dt><div>(⇒ <code>code/removal/advanced</code>)</div>
<code><b>method/removal/parameter</b></code></dt>
<dd>Removes unused method parameters.</dd>
<dt><div>(⇒ <code>code/simplification/advanced</code>)</div>
<code><b>method/propagation/parameter</b></code></dt>
<dd>Propagates the values of method parameters from method invocations to
the invoked methods.</dd>
<dt><div>(⇒ <code>code/simplification/advanced</code>)</div>
<code><b>method/propagation/returnvalue</b></code></dt>
<dd>Propagates the values of method return values from methods to their
invocations.</dd>
<dt><code><b>method/inlining/short</b></code></dt>
<dd>Inlines short methods.</dd>
<dt><code><b>method/inlining/unique</b></code></dt>
<dd>Inlines methods that are only called once.</dd>
<dt><code><b>method/inlining/tailrecursion</b></code></dt>
<dd>Simplifies tail recursion calls, whenever possible.</dd>
<dt><code><b>code/merging</b></code></dt>
<dd>Merges identical blocks of code by modifying branch targets.</dd>
<dt><code><b>code/simplification/variable</b></code></dt>
<dd>Performs peephole optimizations for variable loading and storing.</dd>
<dt><code><b>code/simplification/arithmetic</b></code></dt>
<dd>Performs peephole optimizations for arithmetic instructions.</dd>
<dt><code><b>code/simplification/cast</b></code></dt>
<dd>Performs peephole optimizations for casting operations.</dd>
<dt><code><b>code/simplification/field</b></code></dt>
<dd>Performs peephole optimizations for field loading and storing.</dd>
<dt><div>(⇒ <code>code/removal/simple</code>)</div>
<code><b>code/simplification/branch</b></code></dt>
<dd>Performs peephole optimizations for branch instructions.</dd>
<dt><div>(<i>best used with</i> <code>code/removal/advanced</code>)</div>
<code><b>code/simplification/advanced</b></code></dt>
<dd>Simplifies code based on control flow analysis and data flow
analysis.</dd>
<dt><div>(⇒ <code>code/removal/exception</code>)</div>
<code><b>code/removal/advanced</b></code></dt>
<dd>Removes dead code based on control flow analysis and data flow
analysis.</dd>
<dt><div>(⇒ <code>code/removal/exception</code>)</div>
<code><b>code/removal/simple</b></code></dt>
<dd>Removes dead code based on a simple control flow analysis.</dd>
<dt><code><b>code/removal/variable</b></code></dt>
<dd>Removes unused variables from the local variable frame.</dd>
<dt><code><b>code/removal/exception</b></code></dt>
<dd>Removes exceptions with empty catch blocks.</dd>
<dt><code><b>code/allocation/variable</b></code></dt>
<dd>Optimizes variable allocation on the local variable frame.</dd>
</dl>
<p>
<hr>
<address>
Copyright © 2002-2009
<a href="http://www.graphics.cornell.edu/~eric/">Eric Lafortune</a>.
</address>
</body>
</html>
|