<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Pooled Allocators For The STL</title>
	<atom:link href="http://www.sjbrown.co.uk/2004/05/01/pooled-allocators-for-the-stl/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sjbrown.co.uk/2004/05/01/pooled-allocators-for-the-stl/</link>
	<description>Work log for ideas and hobby projects.</description>
	<lastBuildDate>Thu, 01 Dec 2011 14:25:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: Amro</title>
		<link>http://www.sjbrown.co.uk/2004/05/01/pooled-allocators-for-the-stl/comment-page-1/#comment-22611</link>
		<dc:creator>Amro</dc:creator>
		<pubDate>Sun, 13 Nov 2011 20:55:14 +0000</pubDate>
		<guid isPermaLink="false">http://sjbrown.co.uk/blog/?p=85#comment-22611</guid>
		<description>@Tombox: You should not try to calculate this number yourself as it depends on the implementation of the container. Note that the container will not use your PooledAllocator directly for allocation, but instead will use something like
PooledAllocator&lt; list_node&lt; MyObject, PooledAllocator &gt;::Node &gt;
This is the purpose of the rebind member structure. In other words, the template type T is not MyObject, but an internal node object containing an instance of MyObject as well as list navigation data.

This means that in order to reliably determine the granularity (object size) to use with the pool object, you&#039;ll have to do that from within the PooledAllocator class, since you don&#039;t have access to the actual size that needs to be allocated from anywhere else.

So instead of passing a pointer to a Pool object to the PooledAllocator constructor as done in the sample code, you can have PooledAllocator construct its m_pool itself, or, better yet, select a pool object from a list of Pools depending on sizeof(T).</description>
		<content:encoded><![CDATA[<p>@Tombox: You should not try to calculate this number yourself as it depends on the implementation of the container. Note that the container will not use your PooledAllocator directly for allocation, but instead will use something like<br />
PooledAllocator&lt; list_node&lt; MyObject, PooledAllocator &gt;::Node &gt;<br />
This is the purpose of the rebind member structure. In other words, the template type T is not MyObject, but an internal node object containing an instance of MyObject as well as list navigation data.</p>
<p>This means that in order to reliably determine the granularity (object size) to use with the pool object, you&#8217;ll have to do that from within the PooledAllocator class, since you don&#8217;t have access to the actual size that needs to be allocated from anywhere else.</p>
<p>So instead of passing a pointer to a Pool object to the PooledAllocator constructor as done in the sample code, you can have PooledAllocator construct its m_pool itself, or, better yet, select a pool object from a list of Pools depending on sizeof(T).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tombox</title>
		<link>http://www.sjbrown.co.uk/2004/05/01/pooled-allocators-for-the-stl/comment-page-1/#comment-647</link>
		<dc:creator>Tombox</dc:creator>
		<pubDate>Sun, 08 Feb 2009 13:21:14 +0000</pubDate>
		<guid isPermaLink="false">http://sjbrown.co.uk/blog/?p=85#comment-647</guid>
		<description>Hi,
how do you choose the granularity factor when creating a pool (for example, 32 above)? Is it the supposed node size of the container? So, for example, should I choose 20 for PooledSet (3 pointers + 1 int + 1 bool + padding)
Tx</description>
		<content:encoded><![CDATA[<p>Hi,<br />
how do you choose the granularity factor when creating a pool (for example, 32 above)? Is it the supposed node size of the container? So, for example, should I choose 20 for PooledSet (3 pointers + 1 int + 1 bool + padding)<br />
Tx</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ippokratis</title>
		<link>http://www.sjbrown.co.uk/2004/05/01/pooled-allocators-for-the-stl/comment-page-1/#comment-356</link>
		<dc:creator>Ippokratis</dc:creator>
		<pubDate>Fri, 28 Nov 2008 19:04:29 +0000</pubDate>
		<guid isPermaLink="false">http://sjbrown.co.uk/blog/?p=85#comment-356</guid>
		<description>Hey Simon,

Thanks a bunch for this article. I am developing a multithreaded application on a Sun Niagara II box (64 OS &quot;visible&quot; cpus) and I was getting extremely bad performance with the default std::allocator. 
(note:  your test code will assert on a 64-bit machine). 

I have adapted your test to compare the performance on a multi-threaded environment. 
Below are the results:

$ uname -a
SunOS local 5.10 Generic_127111-09 sun4v sparc SUNW,SPARC-Enterprise-T5220
$ CC -V
CC: Sun C++ 5.9 SunOS_sparc 2007/05/03
$ ./simple

192:main: 1 threads
201:main: Avg. Factor: 1.07
192:main: 2 threads
201:main: Avg. Factor: 1.03
192:main: 4 threads
201:main: Avg. Factor: 0.92
192:main: 8 threads
201:main: Avg. Factor: 0.48
192:main: 16 threads
201:main: Avg. Factor: 0.17
192:main: 32 threads
201:main: Avg. Factor: 0.23


Contact me if you want the updated code.

Cheers,
-Ipporatis.</description>
		<content:encoded><![CDATA[<p>Hey Simon,</p>
<p>Thanks a bunch for this article. I am developing a multithreaded application on a Sun Niagara II box (64 OS &#8220;visible&#8221; cpus) and I was getting extremely bad performance with the default std::allocator.<br />
(note:  your test code will assert on a 64-bit machine). </p>
<p>I have adapted your test to compare the performance on a multi-threaded environment.<br />
Below are the results:</p>
<p>$ uname -a<br />
SunOS local 5.10 Generic_127111-09 sun4v sparc SUNW,SPARC-Enterprise-T5220<br />
$ CC -V<br />
CC: Sun C++ 5.9 SunOS_sparc 2007/05/03<br />
$ ./simple</p>
<p>192:main: 1 threads<br />
201:main: Avg. Factor: 1.07<br />
192:main: 2 threads<br />
201:main: Avg. Factor: 1.03<br />
192:main: 4 threads<br />
201:main: Avg. Factor: 0.92<br />
192:main: 8 threads<br />
201:main: Avg. Factor: 0.48<br />
192:main: 16 threads<br />
201:main: Avg. Factor: 0.17<br />
192:main: 32 threads<br />
201:main: Avg. Factor: 0.23</p>
<p>Contact me if you want the updated code.</p>
<p>Cheers,<br />
-Ipporatis.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- This Quick Cache file was built for (  www.sjbrown.co.uk/2004/05/01/pooled-allocators-for-the-stl/feed/ ) in 0.14424 seconds, on Feb 5th, 2012 at 9:16 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 5th, 2012 at 10:16 am UTC -->
