<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Holsee&#039;s Blog &#187; Programming</title>
	<atom:link href="http://www.blog.holsee.com/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blog.holsee.com</link>
	<description>Adventures in Entrepreneurship, Code, Coffee and Photography..</description>
	<lastBuildDate>Fri, 02 Jul 2010 10:48:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Testing a new Syntax Highlighter Plug-in</title>
		<link>http://www.blog.holsee.com/2010/02/testing-my-new-syntax-highlighter-plug-in/</link>
		<comments>http://www.blog.holsee.com/2010/02/testing-my-new-syntax-highlighter-plug-in/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 16:07:04 +0000</pubDate>
		<dc:creator>holsee</dc:creator>
				<category><![CDATA[Blogging]]></category>
		<category><![CDATA[meta]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.blog.holsee.com/2010/02/testing-my-new-syntax-highlighter-plug-in/</guid>
		<description><![CDATA[I have decided to switch to using Alex Gorbatchev’s Syntax Highlighter.  It is probably the nicest one out there with funky quick copy, print and view source features.
Some Groovy:

def pickEven(n, block)
{
	for(int i = 2; i &#60;= n; i +=2)
	{
		block(i)
	}
}

pickEvent(10, { println it })

Some Ruby:

puts &#34;hi&#34;

Some JavaScript:

/* SyntaxHighlighter */
function foo(){
	// it works!
}

Some C#:

void DoSomething()
{
	ParseALambdaExpression(email =&#62; email.Contains(&#34;@&#34;));
}

void [...]]]></description>
			<content:encoded><![CDATA[<p>I have decided to switch to using <a href=" http://alexgorbatchev.com/wiki/SyntaxHighlighter" target="_blank">Alex Gorbatchev’s Syntax Highlighter</a>.  It is probably the nicest one out there with funky quick copy, print and view source features.</p>
<p>Some Groovy:</p>
<pre class="brush: groovy;">
def pickEven(n, block)
{
	for(int i = 2; i &lt;= n; i +=2)
	{
		block(i)
	}
}

pickEvent(10, { println it })
</pre>
<p>Some Ruby:</p>
<pre class="brush: ruby;">
puts &quot;hi&quot;
</pre>
<p>Some JavaScript:</p>
<pre class="brush: jscript;">
/* SyntaxHighlighter */
function foo(){
	// it works!
}
</pre>
<p>Some C#:</p>
<pre class="brush: csharp;">
void DoSomething()
{
	ParseALambdaExpression(email =&gt; email.Contains(&quot;@&quot;));
}

void ParseALambdaExpression(Expression&lt;func&lt;&lt;string , bool&gt;&gt; func)
{
	BinaryExpression body = func.Body as BinaryExpression;
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.holsee.com/2010/02/testing-my-new-syntax-highlighter-plug-in/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generics in .NET: Value Type Closed Generic Definitions Use More Memory</title>
		<link>http://www.blog.holsee.com/2009/12/generics-in-net-value-type-closed-generic-definitions-use-more-memory/</link>
		<comments>http://www.blog.holsee.com/2009/12/generics-in-net-value-type-closed-generic-definitions-use-more-memory/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 11:50:04 +0000</pubDate>
		<dc:creator>holsee</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.blog.holsee.com/2009/12/generics-in-net-value-type-closed-generic-definitions-use-more-memory/</guid>
		<description><![CDATA[I have started to read the book &#8220;More Effective C# by Bill Wagner&#8221; one of the early points mentioned is the fact that Value types used in closed generic definitions will have a greater memory hit at runtime relative to using reference types.
This is due to the fact that when at least one value type [...]]]></description>
			<content:encoded><![CDATA[<p>I have started to read the book &#8220;More Effective C# by Bill Wagner&#8221; one of the early points mentioned is the fact that Value types used in closed generic definitions will have a greater memory hit at runtime relative to using reference types.</p>
<p>This is due to the fact that when at least one value type is used in a closed generic definition, the CLR when JIT-compiling a generic definition (either a method or a class) will create a separate &#8220;machine code page&#8221; for each value type definition e.g.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">int</span><span style="color: #008000;">&gt;</span> intList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">int</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
List<span style="color: #008000;">&lt;</span>RandomStruct<span style="color: #008000;">&gt;</span> structList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span>RandomStruct<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></pre></div></div>

<p>Generic types that will be used with multiple different reference types do not affect the memory footprint, as a shared machine code page will be used e.g.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span> stringList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span><span style="color: #FF0000;">string</span><span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
List<span style="color: #008000;">&lt;</span>RandomClass<span style="color: #008000;">&gt;</span> classList <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> List<span style="color: #008000;">&lt;</span>RandomClass<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></pre></div></div>

<p>As the C# compiler will enforce type safety at compile time, the JIT compiler can produce a more optimized version of the machine code by assuming that the types are correct.</p>
<p>The reality is that Generics with value types provide many benefits that out weight the memory cost. These include the compile time type safety, the more concise code (no need to parse / cast).</p>
<p>When it comes to working in environments where every single little drop of memory is important such as mobile platforms, this little bit of knowledge may prove valuable, or indeed it may not, but ill leave that up to you to decide.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.holsee.com/2009/12/generics-in-net-value-type-closed-generic-definitions-use-more-memory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
