|
Boost-Commit : |
From: dgregor_at_[hidden]
Date: 2008-04-28 10:11:47
Author: dgregor
Date: 2008-04-28 10:11:46 EDT (Mon, 28 Apr 2008)
New Revision: 44852
URL: http://svn.boost.org/trac/boost/changeset/44852
Log:
Improve documentation on the size/efficiency of boost::function objects
Text files modified:
trunk/libs/function/doc/misc.xml | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
Modified: trunk/libs/function/doc/misc.xml
==============================================================================
--- trunk/libs/function/doc/misc.xml (original)
+++ trunk/libs/function/doc/misc.xml 2008-04-28 10:11:46 EDT (Mon, 28 Apr 2008)
@@ -24,7 +24,7 @@
<para> And, of course, function pointers have several advantages over Boost.Function:
<itemizedlist spacing="compact">
- <listitem><para> Function pointers are smaller (the size of one pointer instead of three) </para></listitem>
+ <listitem><para> Function pointers are smaller (the size of one pointer instead of four or more) </para></listitem>
<listitem><para> Function pointers are faster (Boost.Function may require two calls through function pointers) </para></listitem>
<listitem><para> Function pointers are backward-compatible with C libraries.</para></listitem>
<listitem><para> More readable error messages. </para></listitem>
@@ -37,12 +37,12 @@
<section>
<title>Function object wrapper size</title>
-<para> Function object wrappers will be the size of two function pointers plus one function pointer or data pointer (whichever is larger). On common 32-bit platforms, this amounts to 12 bytes per wrapper. Additionally, the function object target will be allocated on the heap.</para>
+ <para> Function object wrappers will be the size of a struct containing a member function pointer and two data pointers. The actual size can vary significantly depending on the underlying platform; on 32-bit Mac OS X with GCC, this amounts to 16 bytes, while it is 32 bytes Windows with Visual C++. Additionally, the function object target may be allocated on the heap, if it cannot be placed into the small-object buffer in the <code>boost::function</code> object.</para>
</section>
<section>
<title>Copying efficiency</title>
-<para> Copying function object wrappers may require allocating memory for a copy of the function object target. The default allocator may be replaced with a faster custom allocator or one may choose to allow the function object wrappers to only store function object targets by reference (using <computeroutput>ref</computeroutput>) if the cost of this cloning becomes prohibitive.</para>
+ <para> Copying function object wrappers may require allocating memory for a copy of the function object target. The default allocator may be replaced with a faster custom allocator or one may choose to allow the function object wrappers to only store function object targets by reference (using <computeroutput>ref</computeroutput>) if the cost of this cloning becomes prohibitive. Small function objects can be stored within the <code>boost::function</code> object itself, improving copying efficiency.</para>
</section>
<section>
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk