<?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"
	>
<channel>
	<title>Comments on: Allocation Data</title>
	<atom:link href="http://blog.pavlov.net/2007/11/13/allocation-data/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.pavlov.net/2007/11/13/allocation-data/</link>
	<description>Ramblings from the mind of Stuart Parmenter</description>
	<pubDate>Thu, 21 Aug 2008 07:15:19 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
		<item>
		<title>By: Steve</title>
		<link>http://blog.pavlov.net/2007/11/13/allocation-data/#comment-415</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Thu, 15 Nov 2007 13:45:26 +0000</pubDate>
		<guid isPermaLink="false">http://pavlovdotnet.wordpress.com/2007/11/13/allocation-data/#comment-415</guid>
		<description>Heavy use of the stack has it's own problems.

If a given function uses more than 4096 bytes of stack space, Microsoft's compiler will add code to ensure that subsequent pages of memory are actually present.  This makes the code larger and slower.

I wouldn't be surprised to see other compilers generating similar code.

https://bugzilla.mozilla.org/show_bug.cgi?id=359453</description>
		<content:encoded><![CDATA[<p>Heavy use of the stack has it&#8217;s own problems.</p>
<p>If a given function uses more than 4096 bytes of stack space, Microsoft&#8217;s compiler will add code to ensure that subsequent pages of memory are actually present.  This makes the code larger and slower.</p>
<p>I wouldn&#8217;t be surprised to see other compilers generating similar code.</p>
<p><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=359453" rel="nofollow">https://bugzilla.mozilla.org/show_bug.cgi?id=359453</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Leaks? Memory? We never forgot about you. &#171; pavlov.net</title>
		<link>http://blog.pavlov.net/2007/11/13/allocation-data/#comment-411</link>
		<dc:creator>Leaks? Memory? We never forgot about you. &#171; pavlov.net</dc:creator>
		<pubDate>Thu, 15 Nov 2007 09:37:19 +0000</pubDate>
		<guid isPermaLink="false">http://pavlovdotnet.wordpress.com/2007/11/13/allocation-data/#comment-411</guid>
		<description>[...] got a great community and people eager to solve these problems. We&#8217;re now equipped with data and ready to fight this [...]</description>
		<content:encoded><![CDATA[<p>[...] got a great community and people eager to solve these problems. We&#8217;re now equipped with data and ready to fight this [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brendan Eich</title>
		<link>http://blog.pavlov.net/2007/11/13/allocation-data/#comment-410</link>
		<dc:creator>Brendan Eich</dc:creator>
		<pubDate>Thu, 15 Nov 2007 06:18:09 +0000</pubDate>
		<guid isPermaLink="false">http://pavlovdotnet.wordpress.com/2007/11/13/allocation-data/#comment-410</guid>
		<description>Benjamin: Using a single large allocation for a double hashtable instead of lots of little ones for a hashtable with chaining is the right answer if the entry size is small enough. See the big comment near the top of jsdhash.h. If there is a user of {js,pl}dhash configuring too large an entry size, you get a warning in DEBUG builds.

But you didn't mention entry size, so I'm wondering why you think a single large allocation would fragment worse than a bunch of small ones? The table growth uses malloc and free, not realloc. Ignoring overlarge entry size, a double hashtable is strictly less fragmenting than an open table with chaining.

/be</description>
		<content:encoded><![CDATA[<p>Benjamin: Using a single large allocation for a double hashtable instead of lots of little ones for a hashtable with chaining is the right answer if the entry size is small enough. See the big comment near the top of jsdhash.h. If there is a user of {js,pl}dhash configuring too large an entry size, you get a warning in DEBUG builds.</p>
<p>But you didn&#8217;t mention entry size, so I&#8217;m wondering why you think a single large allocation would fragment worse than a bunch of small ones? The table growth uses malloc and free, not realloc. Ignoring overlarge entry size, a double hashtable is strictly less fragmenting than an open table with chaining.</p>
<p>/be</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boris</title>
		<link>http://blog.pavlov.net/2007/11/13/allocation-data/#comment-390</link>
		<dc:creator>Boris</dc:creator>
		<pubDate>Wed, 14 Nov 2007 06:15:24 +0000</pubDate>
		<guid isPermaLink="false">http://pavlovdotnet.wordpress.com/2007/11/13/allocation-data/#comment-390</guid>
		<description>COW is not the problem per se, really.  The main callers of MutatePrep I see in the logs there, inclusing startup, are:

* CDATA section parsing (1500)
* AppendASCIItoUTF16 (~1000)
* nsCookieService::GetCookieInternal (~1500)
* nsHttpHeaderArray::Flatten (~1200)
* AppendUTF16toUTF8 (~2200)
* AppendUTF8toUTF16 (~800)
* nsStandardURL::BuildNormalizedSpec (~3000)
* nsHttpHeaderArray::SetHeader (~8600)
* nsStandardURL::BuildNormalizedSpec (~3500)
* nsCacheService::CreateRequest (~2500)
* nsStandardURL::SetRef (~6000)
* nsStandardURL::Resolve (~700)
* nsStandardURL::GetPath (~400)

I sort of have to stop, but unfortunately I've mostly looked at pretty big allocations there (a lot of the URI stuff does things in the 256+ byte range).  For strings, it might be nice to do another log focusing on that 8-32 range.

The SetRef calls are from LoadBindingDocumentInfo.  I wonder why we even hit that code 6000 times...  I guess we have a lot of bindings.  :(

Could we only allocate once in BuildNormalizedSpec somehow?

nsCacheService::CreateRequest should at the very least preallocate the right string size.  Another option would be to use a key with two strings in it, not just a concatenation of the two strings as a single string key (and hope that if we use two strings they can both share their buffers with caller).

We should really make cookies output nsACString, not a char** and see how much of a difference that makes.  I expect some.  I also wonder whether it's worth precomputing the length we'll need and allocating it all at once instead of going through and doing one append per cookie.  Depends on the typical cookie count, I guess...

Maybe we should do 9-frame stacks to see the callers of the string conversion functions?


</description>
		<content:encoded><![CDATA[<p>COW is not the problem per se, really.  The main callers of MutatePrep I see in the logs there, inclusing startup, are:</p>
<p>* CDATA section parsing (1500)<br />
* AppendASCIItoUTF16 (~1000)<br />
* nsCookieService::GetCookieInternal (~1500)<br />
* nsHttpHeaderArray::Flatten (~1200)<br />
* AppendUTF16toUTF8 (~2200)<br />
* AppendUTF8toUTF16 (~800)<br />
* nsStandardURL::BuildNormalizedSpec (~3000)<br />
* nsHttpHeaderArray::SetHeader (~8600)<br />
* nsStandardURL::BuildNormalizedSpec (~3500)<br />
* nsCacheService::CreateRequest (~2500)<br />
* nsStandardURL::SetRef (~6000)<br />
* nsStandardURL::Resolve (~700)<br />
* nsStandardURL::GetPath (~400)</p>
<p>I sort of have to stop, but unfortunately I&#8217;ve mostly looked at pretty big allocations there (a lot of the URI stuff does things in the 256+ byte range).  For strings, it might be nice to do another log focusing on that 8-32 range.</p>
<p>The SetRef calls are from LoadBindingDocumentInfo.  I wonder why we even hit that code 6000 times&#8230;  I guess we have a lot of bindings.  <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /><br />
Could we only allocate once in BuildNormalizedSpec somehow?</p>
<p>nsCacheService::CreateRequest should at the very least preallocate the right string size.  Another option would be to use a key with two strings in it, not just a concatenation of the two strings as a single string key (and hope that if we use two strings they can both share their buffers with caller).</p>
<p>We should really make cookies output nsACString, not a char** and see how much of a difference that makes.  I expect some.  I also wonder whether it&#8217;s worth precomputing the length we&#8217;ll need and allocating it all at once instead of going through and doing one append per cookie.  Depends on the typical cookie count, I guess&#8230;</p>
<p>Maybe we should do 9-frame stacks to see the callers of the string conversion functions?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stuart Parmenter</title>
		<link>http://blog.pavlov.net/2007/11/13/allocation-data/#comment-389</link>
		<dc:creator>Stuart Parmenter</dc:creator>
		<pubDate>Wed, 14 Nov 2007 05:30:41 +0000</pubDate>
		<guid isPermaLink="false">http://pavlovdotnet.wordpress.com/2007/11/13/allocation-data/#comment-389</guid>
		<description>Benjamin: I can get data for larger allocations.  I'll do that tomorrow.
</description>
		<content:encoded><![CDATA[<p>Benjamin: I can get data for larger allocations.  I&#8217;ll do that tomorrow.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benjamin Smedberg</title>
		<link>http://blog.pavlov.net/2007/11/13/allocation-data/#comment-387</link>
		<dc:creator>Benjamin Smedberg</dc:creator>
		<pubDate>Wed, 14 Nov 2007 04:38:47 +0000</pubDate>
		<guid isPermaLink="false">http://pavlovdotnet.wordpress.com/2007/11/13/allocation-data/#comment-387</guid>
		<description>Pav, is it possible to get the information for large allocs also? At the moz2 meetup today we were pondering whether pldhash/jsdhashtable allocations (which can be very large blocks of memory) could be causing unnecessary fragmentation, and whether a plhash (chaining) system might be better for certain allocation types.
</description>
		<content:encoded><![CDATA[<p>Pav, is it possible to get the information for large allocs also? At the moz2 meetup today we were pondering whether pldhash/jsdhashtable allocations (which can be very large blocks of memory) could be causing unnecessary fragmentation, and whether a plhash (chaining) system might be better for certain allocation types.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: darin</title>
		<link>http://blog.pavlov.net/2007/11/13/allocation-data/#comment-386</link>
		<dc:creator>darin</dc:creator>
		<pubDate>Wed, 14 Nov 2007 02:50:32 +0000</pubDate>
		<guid isPermaLink="false">http://pavlovdotnet.wordpress.com/2007/11/13/allocation-data/#comment-386</guid>
		<description>perhaps CoW strings are causing more harm than good.
</description>
		<content:encoded><![CDATA[<p>perhaps CoW strings are causing more harm than good.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
