<?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>.NET Tips and Tricks &#187; Performance</title>
	<atom:link href="http://kossovsky.net/index.php/tag/performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://kossovsky.net</link>
	<description>C# Code Snippets, ASP.NET Code Samples, .NET Tips and Tricks</description>
	<lastBuildDate>Sat, 25 Dec 2010 08:32:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>C# Rectangle Packing</title>
		<link>http://kossovsky.net/index.php/2009/07/cshar-rectangle-packing/</link>
		<comments>http://kossovsky.net/index.php/2009/07/cshar-rectangle-packing/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 12:45:48 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[ascii character]]></category>
		<category><![CDATA[bitmap fonts]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[c-sharp]]></category>
		<category><![CDATA[common interface]]></category>
		<category><![CDATA[cygon]]></category>
		<category><![CDATA[Gif]]></category>
		<category><![CDATA[humble webmaster]]></category>
		<category><![CDATA[lightmaps]]></category>
		<category><![CDATA[linear increase]]></category>
		<category><![CDATA[net c#]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Png]]></category>
		<category><![CDATA[Puzzle]]></category>
		<category><![CDATA[space efficiency]]></category>
		<category><![CDATA[Speed]]></category>
		<category><![CDATA[suitable position]]></category>
		<category><![CDATA[support assembly]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[visual c#]]></category>

		<guid isPermaLink="false">http://kossovsky.net/?p=414</guid>
		<description><![CDATA[Sometimes, you&#8217;re faced with the problem to cramp as many smaller textures as possible onto a larger texture. Typical cases are lightmaps, which are very small textures with dimensions that usually are not powers of two, or bitmap fonts where you want to try and fit the entire ascii character set onto a texture without [...]<br /><div><img src="http://kossovsky.net/wp-content/plugins/gd-star-rating/gfx.php?value=4.3" /></div><div>Rating: 4.3/<strong>5</strong> (6 votes cast)</div><br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://kossovsky.net/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br />]]></description>
			<content:encoded><![CDATA[<p>Sometimes, you&#8217;re faced with the problem to cramp as many smaller textures as possible onto a larger texture. Typical cases are lightmaps, which are very small textures with dimensions that usually are not powers of two, or bitmap fonts where you want to try and fit the entire ascii character set onto a texture without wasting much space.</p>
<p>What you need then, is a rectangle packer, an algorithm that arranges as many smaller rectangles on a larger rectangle as can possibly fit.</p>
<p><span id="more-414"></span></p>
<p>The <a title="Nuclex - Rectangle Packing" href="http://www.nuclex.org/pages/framework/rectangle-packing" target="_blank">Nuclex.Support</a> assembly contains several rectangle packing algorithms in the Nuclex.Support.Packing namespace offering various levels of compromises between space efficiency and runtime performance. All of these algorithms have been implemented as classes with a common interface, so, once implemented, you can easily switch forth and back between different algorithms to find the one best suites for your purpose.</p>
<p>Currently, there are three different packing algorithms for you to choose:</p>
<table style="width: 100%; border: none;" border="0" cellspacing="2" cellpadding="0">
<tbody>
<tr>
<td style="border:none;padding-bottom:20px;" align="center" valign="top"><img style="padding: 0px; margin: 0px; border: none;" title="The Simple Packer" src="http://kossovsky.net/wp-content/uploads/2009/07/simple-rectangle-packer.png" alt="The Simple Packer" width="128" height="128" /></td>
<td style="border:none;padding-bottom:20px;" valign="top"><strong>The Simple Packer</strong><br />
This packer is optimized for runtime performance. It does sacrifice a bit of space, but the time needed to find a position for a new rectangle is O(1). In english, that means it doesn&#8217;t take longer to search for a suitable position, no matter how many rectangles have been added to the packing area.</td>
</tr>
<tr>
<td style="border:none;padding-bottom:20px;" align="center" valign="top"><img style="padding: 0px; margin: 0px; border: none;" title="cygon-rectangle-packer" src="http://kossovsky.net/wp-content/uploads/2009/07/cygon-rectangle-packer.png" alt="The Cygon Packer" width="128" height="128" /></td>
<td style="border:none;padding-bottom:20px;" valign="top"><strong>The Cygon Packer</strong><br />
Named after your humble webmaster, this algorithm is highly efficient in its space usage and offers reasonable performance. It will never exceed O(n) time but generally achieves almost O(1) on average. English translation: Search time is usually constant and guaranteed to never exceed a linear increase (so when you&#8217;ve got 99 rectangles already packed and add the 100th one, it guarantees that search time will at most be 1% longer than the time taken for the previous rectangle).</td>
</tr>
<tr>
<td style="border:none;padding-bottom:20px;" align="center" valign="top"><img style="padding: 0px; margin: 0px; border: none;" title="arevalo-rectangle-packer" src="http://kossovsky.net/wp-content/uploads/2009/07/arevalo-rectangle-packer.png" alt="The Arevalo Packer" width="128" height="128" /></td>
<td style="border:none;padding-bottom:20px;" valign="top"><strong>The Arevalo Packer</strong><br />
Named after Javier Arevalo, who posted his implementation of this packer on flipcode back in the golden times. This algorithm offers very good space efficiency and runs in slightly less then O(n) time. Just to be consistent, in english, that means, the time needed to find a suitable place for a new rectangle will only increase linearly.</td>
</tr>
</tbody>
</table>
<p>You can download the C# version of the algorithms from <a title="Nuclex Framework - C# Source Code" href="https://devel.nuclex.org/framework/browser/game/Nuclex.Game/trunk/Source/Packing" target="_blank">here</a>.</p>
<p>The usage is very simple :</p>
<pre class="c-sharp" name="code">
	Point PP;
	var ARP = new ArevaloRectanglePacker(200, 200);

	if(!ARP.TryPack(Width, Height, out PP)) {
		// Do something
	}
	else {
		// Do something else
	}
</pre>
<br /><div><img src="http://kossovsky.net/wp-content/plugins/gd-star-rating/gfx.php?value=4.3" /></div><div>Rating: 4.3/<strong>5</strong> (6 votes cast)</div><br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://kossovsky.net/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br />
<p class="FacebookLikeButton"><fb:like href="http%3A%2F%2Fkossovsky.net%2Findex.php%2F2009%2F07%2Fcshar-rectangle-packing%2F" layout="standard" show_faces="false" width="450" action="like" colorscheme="light"></fb:like></p>
]]></content:encoded>
			<wfw:commentRss>http://kossovsky.net/index.php/2009/07/cshar-rectangle-packing/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>SpeedTrace &#8211; .NET Profiler and Tracer</title>
		<link>http://kossovsky.net/index.php/2009/07/speedtrace-net-profiler-and-tracer/</link>
		<comments>http://kossovsky.net/index.php/2009/07/speedtrace-net-profiler-and-tracer/#comments</comments>
		<pubDate>Thu, 09 Jul 2009 11:28:30 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Profiling Tools]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[QA]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[c-sharp]]></category>
		<category><![CDATA[data flow]]></category>
		<category><![CDATA[dot net framework]]></category>
		<category><![CDATA[dot net framework 2]]></category>
		<category><![CDATA[flow problems]]></category>
		<category><![CDATA[net c#]]></category>
		<category><![CDATA[peak times]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[performance bottlenecks]]></category>
		<category><![CDATA[profiler]]></category>
		<category><![CDATA[profilers]]></category>
		<category><![CDATA[profiling]]></category>
		<category><![CDATA[program flow]]></category>
		<category><![CDATA[return values]]></category>
		<category><![CDATA[Speed]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[visual c#]]></category>

		<guid isPermaLink="false">http://kossovsky.net/?p=406</guid>
		<description><![CDATA[It is very important to be able to dynamically control the behavior of .NET applications and to keep track of some of the aspects of the application (i.e. how the application is performing, what errors are produced during runtime, how the application performs at peak times, how to dynamically alter the behavior of the application, [...]<br /><div><img src="http://kossovsky.net/wp-content/plugins/gd-star-rating/gfx.php?value=4.7" /></div><div>Rating: 4.7/<strong>5</strong> (7 votes cast)</div><br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://kossovsky.net/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br />]]></description>
			<content:encoded><![CDATA[<p>It is very important to be able to dynamically control the behavior of .NET applications and to keep track of some of the aspects of the application (i.e. how the application is performing, what errors are produced during runtime, how the application performs at peak times, how to dynamically alter the behavior of the application, etc).</p>
<p><span id="more-406"></span></p>
<p>The <a title="SpeedTrace - .NET Profiler and Tracer" href="http://www.ipcas.com/trace-and-profile/c-sharp-and-vb.net-tracer-and-profiler/" target="_blank">SpeedTrace Pro</a> profiler follows and records the program flow of any .NET application on a function/method level for later profiling or tracing analysis, allowing you to identify performance bottlenecks, deadlocks, software design problems as well as resource and data flow problems.</p>
<p>One of the nicest features in this application is the presence of  &#8220;Callback-API&#8221;.<br />
It provides user-extended functionality to allow developers to adapt the tracer to their needs and to write user-specific extensions for dot.NET Framework 2.0, 3.0 or 3.5 applications.</p>
<p>SpeedTrace Pro can make accessible the arguments and return values of a function. This outstanding feature enables you not only to trace function calls but also to obtain the values passed or returned &#8211; important data that normal profilers lose during aggregations. You can make use of this data to obtain the relevant information, especially when bugs appear under certain conditions.</p>
<p>The data tracing values of .NET applications may be used to trap bugs easily and to perform data-dependent analyses.</p>
<div id="attachment_408" class="wp-caption alignnone" style="width: 310px"><img class="size-medium wp-image-408" title="dotnet-tracer-and-profiler" src="http://kossovsky.net/wp-content/uploads/2009/07/dotnet-tracer-and-profiler-300x224.png" alt="SpeedTrace - .NET Profiler and Tracer" width="300" height="224" /><p class="wp-caption-text">SpeedTrace - .NET Profiler and Tracer</p></div>
<br /><div><img src="http://kossovsky.net/wp-content/plugins/gd-star-rating/gfx.php?value=4.7" /></div><div>Rating: 4.7/<strong>5</strong> (7 votes cast)</div><br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://kossovsky.net/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br />
<p class="FacebookLikeButton"><fb:like href="http%3A%2F%2Fkossovsky.net%2Findex.php%2F2009%2F07%2Fspeedtrace-net-profiler-and-tracer%2F" layout="standard" show_faces="false" width="450" action="like" colorscheme="light"></fb:like></p>
]]></content:encoded>
			<wfw:commentRss>http://kossovsky.net/index.php/2009/07/speedtrace-net-profiler-and-tracer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSS Sprite Generator</title>
		<link>http://kossovsky.net/index.php/2009/06/css-sprite-generator/</link>
		<comments>http://kossovsky.net/index.php/2009/06/css-sprite-generator/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 21:29:32 +0000</pubDate>
		<dc:creator>Xander</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Graphics]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[c-sharp]]></category>
		<category><![CDATA[composite image]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS Sprite]]></category>
		<category><![CDATA[css sprites]]></category>
		<category><![CDATA[multiple images]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[positioning]]></category>
		<category><![CDATA[Puzzle]]></category>
		<category><![CDATA[Speed]]></category>
		<category><![CDATA[sprite]]></category>

		<guid isPermaLink="false">http://kossovsky.net/?p=3</guid>
		<description><![CDATA[CSS sprites group multiple images into one composite image and display them using CSS background positioning. Coming soon… Rating: 0.0/5 (0 votes cast)<br /><div><img src="http://kossovsky.net/wp-content/plugins/gd-star-rating/gfx.php?value=0.0" /></div><div>Rating: 0.0/<strong>5</strong> (0 votes cast)</div><br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://kossovsky.net/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br />]]></description>
			<content:encoded><![CDATA[<p>CSS sprites group multiple images into one composite image and display them using CSS background positioning.</p>
<p>Coming soon…</p>
<br /><div><img src="http://kossovsky.net/wp-content/plugins/gd-star-rating/gfx.php?value=0.0" /></div><div>Rating: 0.0/<strong>5</strong> (0 votes cast)</div><br /><a target="_blank" href="http://www.gdstarrating.com/"><img src="http://kossovsky.net/wp-content/plugins/gd-star-rating/gfx/powered.png" border="0" width="80" height="15" /></a><br />
<p class="FacebookLikeButton"><fb:like href="http%3A%2F%2Fkossovsky.net%2Findex.php%2F2009%2F06%2Fcss-sprite-generator%2F" layout="standard" show_faces="false" width="450" action="like" colorscheme="light"></fb:like></p>
]]></content:encoded>
			<wfw:commentRss>http://kossovsky.net/index.php/2009/06/css-sprite-generator/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

