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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>optimize (ANSI and GNU Common Lisp Document)</title>
<meta name="description" content="optimize (ANSI and GNU Common Lisp Document)">
<meta name="keywords" content="optimize (ANSI and GNU Common Lisp Document)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html" rel="start" title="Top">
<link href="Evaluation-and-Compilation-Dictionary.html" rel="up" title="Evaluation and Compilation Dictionary">
<link href="special.html" rel="next" title="special">
<link href="declaration.html" rel="prev" title="declaration">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<span id="optimize"></span><div class="header">
<p>
Next: <a href="special.html" accesskey="n" rel="next">special</a>, Previous: <a href="declaration.html" accesskey="p" rel="prev">declaration</a>, Up: <a href="Evaluation-and-Compilation-Dictionary.html" accesskey="u" rel="up">Evaluation and Compilation Dictionary</a> </p>
</div>
<hr>
<span id="optimize-_005bDeclaration_005d"></span><h4 class="subsection">3.8.25 optimize [Declaration]</h4>
<span id="Syntax_003a_003a-8"></span><h4 class="subsubheading">Syntax::</h4>
<p><tt>(optimize {<i>quality</i> | (<i>quality</i> <i>value</i>)}*)</tt>
</p>
<span id="index-compilation_002dspeed"></span>
<span id="index-debug"></span>
<span id="index-safety-1"></span>
<span id="index-space-1"></span>
<span id="index-speed"></span>
<span id="Arguments_003a_003a-8"></span><h4 class="subsubheading">Arguments::</h4>
<p><i>quality</i>—an <i>optimize quality</i>.
</p>
<p><i>value</i>—one of the <i>integers</i> <tt>0</tt>, <tt>1</tt>, <tt>2</tt>, or <tt>3</tt>.
</p>
<span id="Valid-Context_003a_003a-6"></span><h4 class="subsubheading">Valid Context::</h4>
<p><i>declaration</i> or <i>proclamation</i>
</p>
<span id="Description_003a_003a-24"></span><h4 class="subsubheading">Description::</h4>
<p>Advises the compiler that each <i>quality</i> should be given attention
according to the specified corresponding <i>value</i>.
Each <i>quality</i> must be a <i>symbol</i> naming an <i>optimize quality</i>;
the names and meanings of the standard <i>optimize qualities</i> are shown in
Figure 3–25.
</p>
<div class="format">
<pre class="format"> Name Meaning <!-- /@w -->
<b>compilation-speed</b> speed of the compilation process <!-- /@w -->
<b>debug</b> ease of debugging <!-- /@w -->
<b>safety</b> run-time error checking <!-- /@w -->
<b>space</b> both code size and run-time space <!-- /@w -->
<b>speed</b> speed of the object code <!-- /@w -->
Figure 3–25: Optimize qualities <!-- /@w -->
</pre></div>
<p>There may be other, <i>implementation-defined</i> <i>optimize qualities</i>.
</p>
<p>A <i>value</i> <tt>0</tt> means that the corresponding <i>quality</i> is totally
unimportant, and <tt>3</tt> that the <i>quality</i> is extremely important;
<tt>1</tt> and <tt>2</tt> are intermediate values, with <tt>1</tt> the
neutral value.
<tt>(<i>quality</i> 3)</tt> can be abbreviated to <i>quality</i>.
</p>
<p>Note that <i>code</i> which has the optimization <tt>(safety 3)</tt>,
or just <b>safety</b>,
is called <i>safe</i> <i>code</i>.
</p>
<p>The consequences are unspecified if a <i>quality</i> appears more than once
with <i>different</i> <i>values</i>.
</p>
<span id="Examples_003a_003a-20"></span><h4 class="subsubheading">Examples::</h4>
<div class="example">
<pre class="example"> (defun often-used-subroutine (x y)
(declare (optimize (safety 2)))
(error-check x y)
(hairy-setup x)
(do ((i 0 (+ i 1))
(z x (cdr z)))
((null z))
;; This inner loop really needs to burn.
(declare (optimize speed))
(declare (fixnum i))
))
</pre></div>
<span id="See-Also_003a_003a-24"></span><h4 class="subsubheading">See Also::</h4>
<p><b>declare</b>,
<a href="declaim.html">declaim</a>
,
<a href="proclaim.html">proclaim</a>
,
<a href="Declaration-Scope.html">Declaration Scope</a>
</p>
<span id="Notes_003a_003a-14"></span><h4 class="subsubheading">Notes::</h4>
<p>An <b>optimize</b> declaration never applies to either a <i>variable</i> or
a <i>function</i> <i>binding</i>. An <b>optimize</b> declaration can only
be a <i>free declaration</i>. For more information, see <a href="Declaration-Scope.html">Declaration Scope</a>.
</p>
<hr>
<div class="header">
<p>
Next: <a href="special.html" accesskey="n" rel="next">special</a>, Previous: <a href="declaration.html" accesskey="p" rel="prev">declaration</a>, Up: <a href="Evaluation-and-Compilation-Dictionary.html" accesskey="u" rel="up">Evaluation and Compilation Dictionary</a> </p>
</div>
</body>
</html>
|