emacs.d/clones/www.sbcl.org/sbcl-internals/MOP-Optimizations.html
2023-01-18 20:30:47 +01:00

64 lines
2.8 KiB
HTML

<html lang="en">
<head>
<title>MOP Optimizations - SBCL Internals</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="SBCL Internals">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Slot_002dValue.html#Slot_002dValue" title="Slot-Value">
<link rel="prev" href="Compiler-Transformations.html#Compiler-Transformations" title="Compiler Transformations">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This manual is part of the SBCL software system. See the `README'
file for more information.
This manual is in the public domain and is provided with
absolutely no warranty. See the `COPYING' and `CREDITS' files for
more information.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="MOP-Optimizations"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Compiler-Transformations.html#Compiler-Transformations">Compiler Transformations</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Slot_002dValue.html#Slot_002dValue">Slot-Value</a>
<hr>
</div>
<!-- node-name, next, previous, up -->
<h3 class="section">7.3 MOP Optimizations</h3>
<p>Even when nothing is known at compile-time about the call to
<code>slot-value</code>, it is possible to do marginally better than in
<a href="ex_003aslot_002dvalue_002dusing_002dclass.html#ex_003aslot_002dvalue_002dusing_002dclass">Example 7.2</a>. Each effective slot definition
metaobject can cache its own effective method, and the discriminating
function for <code>slot-value-using-class</code> is set to simply call the
function in its slot definition argument.
<p>(FIXME: I'm pretty sure this is a bad plan in general. Or rather, it's
probably a good plan, but the effective methods should probably be
computed lazily rather than eagerly. The default image has 8589
closures implementing this optimization: 3 (<code>slot-value</code>,
<code>set-slot-value</code> and <code>slot-boundp</code>) for each of 2863 effective
slots.)
<p>(Also note that this optimization depends on not being able to
specialize the <code>new-value</code> argument to <code>(setf
slot-value-using-class)</code>.)
</body></html>