<?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>Yet Another [À Compléter] &#187; C#</title>
	<atom:link href="http://blog.neteril.org/category/programming/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.neteril.org</link>
	<description>Random thoughts of Jérémie Laval</description>
	<lastBuildDate>Wed, 24 Aug 2011 17:43:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>GSoC 2011 &#8211; TPL Dataflow</title>
		<link>http://blog.neteril.org/2011/08/24/gsoc-2011-tpl-dataflow/</link>
		<comments>http://blog.neteril.org/2011/08/24/gsoc-2011-tpl-dataflow/#comments</comments>
		<pubDate>Wed, 24 Aug 2011 11:31:54 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.neteril.org/?p=1132</guid>
		<description><![CDATA[This summer I have been working again as a Google Summer of Code student for Mono. This time, I re-implemented another parallel-related library called TPL Dataflow. It&#8217;s still a research project at Microsoft and it has recently released a preview version of the framework which is designed to work well with the asynchronous features of [...]]]></description>
			<content:encoded><![CDATA[<p>This summer I have been working again as a <a href="http://code.google.com/soc/">Google Summer of Code</a> student for Mono. This time, I re-implemented another parallel-related library called <a href="http://msdn.microsoft.com/en-us/devlabs/gg585582">TPL Dataflow</a>.</p>
<p>It&#8217;s still a research project at Microsoft and it has recently released a preview version of the framework which is designed to work well with the asynchronous features of the latest .NET CTP.</p>
<p>The goal of the framework is similar to PLinq in the sense that you construct a pipeline composed of blocks expressing individual operation (action, transformation, join, fork, &#8230;) with the notable difference that the model is push-based instead of pull-based.</p>
<p>Push-based basically means that, in the same way than the <a href="http://msdn.microsoft.com/en-us/data/gg577609">Reactive Extensions</a>, you explicitly feed data to your pipeline instead of acquiring it from a source. Then the final data can be received or processed by a block at the other end of the chain.</p>
<p>All of that makes a nice model for asynchronicity that you can use both to send or receive data thanks to a number of extensions method in the framework (suffixed by <code>Async</code>) which returns a <code>Task</code> thus letting you setup continuations or use the new <code>await</code> keyword (also available in Mono master btw).</p>
<p>Under the hood the framework is built upon what ParallelFx provides like the concurrent collections and the task primitive meaning it&#8217;s also taking full advantage of the available parallelism on your machine.</p>
<p>The code is now available directly from Mono master and is built in the <code>System.Threading.Tasks.Dataflow</code> assembly with the 4.0 profile. While not totally complete, it&#8217;s still already usable.</p>
<p>MSDN doesn&#8217;t yet show the documentation so I <a href="http://neteril.org/~jeremie/mono/tpl-dataflow/">uploaded the copy</a> shipped with the preview. </p>
<p>You can also watch Stephen Toub <a href="http://channel9.msdn.com/posts/TPL-Dataflow-Tour">introductory video</a> for a tour of the framework (also embedded below).</p>
<div style="height:288px;width:512px;margin:auto"><iframe style="height:288px;width:512px;margin:auto;" src="http://channel9.msdn.com/posts/TPL-Dataflow-Tour/player?w=512&#038;h=288" frameBorder="0" scrolling="no" ></iframe></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2011/08/24/gsoc-2011-tpl-dataflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Going parallel on mobile devices</title>
		<link>http://blog.neteril.org/2011/07/25/going-parallel-on-mobile-devices/</link>
		<comments>http://blog.neteril.org/2011/07/25/going-parallel-on-mobile-devices/#comments</comments>
		<pubDate>Sun, 24 Jul 2011 22:28:32 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.neteril.org/?p=1116</guid>
		<description><![CDATA[It took around 20 years for CPU manufacturers to abandon the GHz war on the desktop and start going multicore. In the mobile space and only 3 years after the first Android smartphone, we are already seeing dual-cores phones (with quad-cores around the corner). Recent tablets are on the same boat. The brilliant thing is [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><a href="http://blog.neteril.org/wp-content/uploads/2011/07/device-2011-07-19-175035.png"><img src="http://blog.neteril.org/wp-content/uploads/2011/07/device-2011-07-19-175035.png" alt="" title="device-2011-07-19-175035" width="240" height="400" class="aligncenter size-full wp-image-1117" /></a></p>
<p>It took around 20 years for CPU manufacturers to abandon the GHz war on the desktop and start going multicore. </p>
<p>In the mobile space and only 3 years after the first Android smartphone, we are already seeing dual-cores phones (with quad-cores around the corner). Recent tablets are on the same boat.</p>
<p>The brilliant thing is that with <a href="http://android.xamarin.com/">Monodroid</a> and <a href="http://ios.xamarin.com/">Monotouch</a>, we have the possibility to harness this new found processing power today using all the existing ParallelFx constructs since they are part of both distributions (i.e. Tasks, continuations, parallel loops, PLinq and friends).</p>
<p>To illustrate that, I ported the now classic raytracer code from the Parallel sample gallery to Android using Monodroid. Code is on <a href="https://github.com/garuma/raydroid">GitHub</a> if you want to give it a spin.</p>
<p>While the application itself is painfully slow since all rendering is in software, it does exhibit the same speed improvement when you ran in parallel mode as with the desktop version on my dual-core smartphone. For iDevices lovers, <a href="http://blog.sublimeintervention.com/">Geoff</a> also had a similar version running on an iPad 2.</p>
<p>If you are at Monospace and want to talk about that stuff (and ParallelFx in general), don&#8217;t hesitate to come and say hi. Anyhow, I&#8217;ll continue to post more examples of how you can use ParallelFx practically in your mobile apps.</p>
<p>PS: as you&#8217;ll see in the source, there are some hacks bundled because of a couple of Mono bugs but they will get fixed eventually.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2011/07/25/going-parallel-on-mobile-devices/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Announcing dbus-sharp first release</title>
		<link>http://blog.neteril.org/2010/09/15/announcing-dbus-sharp-first-release/</link>
		<comments>http://blog.neteril.org/2010/09/15/announcing-dbus-sharp-first-release/#comments</comments>
		<pubDate>Wed, 15 Sep 2010 11:01:52 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.neteril.org/?p=991</guid>
		<description><![CDATA[Over the last weeks, a little group of developers has been working on an updated version of the DBus C# binding initially written by Alp Toker over at NDesk. Initial efforts have been devoted to integrate patches that had been lying around for some time but never actually got released in a proper way causing [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last weeks, a little group of developers has been working on an updated version of the DBus C# binding initially written by Alp Toker over at <a href="http://ndesk.org/DBus">NDesk</a>. </p>
<p>Initial efforts have been devoted to integrate patches that had been lying around for some time but never actually got released in a proper way causing some projects to bundle a modified ndesk-dbus source tree in their codebase.</p>
<p>As part of the fork process, we have moved</a> all the relevant project infrastructure over to GitHub including <a href="http://github.com/mono/dbus-sharp">source code</a>, <a href="http://mono.github.com/dbus-sharp/">website</a>, <a href="http://github.com/mono/dbus-sharp/downloads">tarball downloads</a> and <a href="http://github.com/mono/dbus-sharp/issues">bug tracking</a>.</p>
<p>As stated in the <a href="http://github.com/mono/dbus-sharp/wiki/Release-notes-dbus-sharp-0.7-and-dbus-sharp-glib-0.5">release notes</a>, all the dbus-sharp component are parallel installable with the original ndesk-dbus ones and can co-exist happily. In addition, we made sure the porting effort required to move an existing application to use dbus-sharp instead of ndesk-dbus was reduced to a minimum.</p>
<p>For future work, we are going to continue cleaning and refactoring the binding, improve its test suite and of course add new features so stay tuned!</p>
<p>You can directly jump to the <a href="http://github.com/mono/dbus-sharp/wiki/Release-notes-dbus-sharp-0.7-and-dbus-sharp-glib-0.5">release notes</a> for all the details on how to get dbus-sharp and how to use it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2010/09/15/announcing-dbus-sharp-first-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tying Mono and OpenCL</title>
		<link>http://blog.neteril.org/2010/06/18/tying-mono-and-opencl/</link>
		<comments>http://blog.neteril.org/2010/06/18/tying-mono-and-opencl/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 17:09:01 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.neteril.org/?p=939</guid>
		<description><![CDATA[One of the cool buzzword these days beside parallel computing is GPGPU as in General Purpose GPU. The base idea of GPGPU is to allow a programmer to tape in the parallel processing capacities of a GPU to do something different than pixel crushing (even though it mostly boils down to that very application most [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><a href="http://www.flickr.com/photos/un_owen/166787202/"><img src="http://blog.neteril.org/wp-content/uploads/2010/06/tortoise_hare.jpg" alt="tortoise_hare" title="tortoise_hare" width="507" height="380" class="aligncenter size-full wp-image-953" /></a></p>
<p>One of the cool buzzword these days beside parallel computing is GPGPU as in General Purpose GPU.</p>
<p>The base idea of GPGPU is to allow a programmer to tape in the parallel processing capacities of a GPU to do something different than pixel crushing (even though it mostly boils down to that very application most of time). </p>
<p>GPGPU isn&#8217;t new and for a long time vendors have provided their own rather low-level toolkit to program arbitrarily a GPU. As often, someone stepped up one day and proposed a unified API on top of all the vendor specificities. In our case, that API is a standard defined by the <a href="http://www.khronos.org/">Khronos group</a> (think OpenGL) and is named <a href="http://www.khronos.org/opencl/">OpenCL</a>.</p>
<p>OpenCL defines both a high-level C API to manipulate GPU (plus other friends) and a C-like intermediate language that is compiled and ultimately run on the device. It&#8217;s actually the same model as shader programming.</p>
<p>In the pursuit of <a href="http://www.mono-project.com">Mono</a> world-domination and following the implementation of PLinq that strived to be an easy way for programmer to access the multicore architecture of our processors via Linq, I hereby introduce <em>GLinq</em> (unoriginal acronym for GPU Linq) which this time use your graphic card to execute Linq queries via OpenCL. </p>
<p>GLinq is still much in its infancy and currently only support the Linq&#8217;s Select operator but I hope to be able to implement several other operators (at least the classic Where-Aggregate combo). The end goal is also to provide a new set of operator to allow OpenGL code to access the results of the computation without doing a roundtrip between CPU and GPU.</p>
<p>As I said previously, GLinq has the same design goal as PLinq which was to provide a totally new execution model for programmer in the most transparent way possible and with little modification to existing code. In our case, this prerequisite is rather tricky since you are juggling between two totally different worlds.</p>
<p>GLinq tries to provide that seamless experience with two features. The first one is the use of expression trees and C# compiler lambda magic to automatically capture the sense of a C# expression and rewrite it to OpenCL intermediate language. The second one is an automatic mapping of C# types and methods (e.g. Math class functions) to corresponding OpenCL symbols without however sacrificing OpenCL specificities which are also exposed through a C# API (not complete). </p>
<p>Of course, the GLinq API is still a transcription of standard Linq so you use it in the same way via the GpuEnumerable class. At the moment, the only input support are Range and Repeat but that will easily be changed to support any kind of IEnumerable.</p>
<p>Below is an example of the kind of query you can already execute:</p>
<pre class="brush: csharp; title: ; notranslate">

var query = GpuEnumerable.Range (-20, 50)
			 .Select ((i) =&gt; i * -2 + 3)
			 .Select ((i) =&gt; Math.Abs (i))
			 .Select ((i) =&gt; ExtraMath.Ldexp ((float)i, 2f))
			 .Select ((i) =&gt; (int)i);

foreach (var i in query)
	Console.Write (&quot;{0}, &quot;, i.ToString ());
</pre>
<p>From what you can see, there are a lot of select operators here. It comes from the fact that the compiler is only able to convert a pure expression lambda to its corresponding expression tree. You can circumvent this limitation by building yourself the expression tree or by using any compiler/interpreter that outputs expression trees (e.g. IronPython, IronRuby, Bechamel).</p>
<p>On a final note, there is an acknowledged bug in at least NVidia implementation of OpenCL which makes Mono doesn&#8217;t play nice with it. This is due to the fact that (most) OpenCL implementations use LLVM for code generation/optimization which in turns mess with Mono internal working.</p>
<p>This problem is going to be fixed in the next NVidia driver iteration but as a work-around you can apply <a href="http://monobin.com/__md461851">this simple patch</a> to mono. I put <del datetime="2010-06-18T18:01:11+00:00">SIGWINCH</del>SIGXFSZ there because it looks cool and seems generally unused but any other should do the trick.</p>
<p>Code in its proof-of-concept form is living here: <a href="http://git.neteril.org/glinq/">http://git.neteril.org/glinq/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2010/06/18/tying-mono-and-opencl/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Zencomic 0.3 &#8211; &#171;&#160;Holy Crêpe&#160;&#187;</title>
		<link>http://blog.neteril.org/2010/05/09/zencomic-0-3-holy-crepe/</link>
		<comments>http://blog.neteril.org/2010/05/09/zencomic-0-3-holy-crepe/#comments</comments>
		<pubDate>Sun, 09 May 2010 18:57:43 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[zencomic]]></category>

		<guid isPermaLink="false">http://blog.neteril.org/?p=911</guid>
		<description><![CDATA[I&#8217;m proud to announce the next release of Zencomic, the comic strip-driven productivity enhancer that periodically makes your day funnier by showing comic like Dilbert or XKCD in a bubble. New stuff This release packs a fair number of internal change, UI polishing and a good deal of new comic providers for your pleasure. Comic [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><a href="http://icanhascheezburger.com/2009/04/01/funny-pictures-holy-crepe/"><img src="http://blog.neteril.org/wp-content/uploads/2010/05/holy-crepe.jpg" alt="holy-crepe" title="holy-crepe" width="500" height="336" class="aligncenter size-full wp-image-912" /></a></p>
<p>I&#8217;m proud to announce the next release of <a href="http://neteril.org/projects/zencomic/">Zencomic</a>, the comic strip-driven productivity enhancer that periodically makes your day funnier by showing comic like Dilbert or XKCD in a bubble.</p>
<h3>New stuff</h3>
<p>This release packs a fair number of internal change, UI polishing and a good deal of new comic providers for your pleasure.</p>
<h4>Comic backends</h4>
<p>Among comic newcomers, you will find <a href="http://trollcats.com/">Trollcats</a> joining their lolz counterparts and the duo <a href="http://garfield.com/">Garfield</a> and <a href="http://garfieldminusgarfield.net/">Garfield Minus Garfield</a> (contributed by <a href="http://monotorrent.blogspot.com/">Alan Mc Govern</a>) for even more fluffy fun (or not).</p>
<p align="center"><img src="http://blog.neteril.org/wp-content/uploads/2010/05/zencomic_screen_garfield.png" alt="zencomic_screen_garfield" title="zencomic_screen_garfield" width="612" height="229" class="aligncenter size-full wp-image-923" /><br /><em>Welcome to the laziest cat on Earth</em></p>
<h4>Cosmetic changes</h4>
<p>In Window mode, the comic are now correctly resized to take reasonable space on your screen. A link to the original strip is also supplied at the bottom of the window.</p>
<p>The preferences panel has been overhauled to be less cluttered and provide direct management of comic addins in the UI. It&#8217;s also now hopefully completely WM proof when it comes to showing up focused.</p>
<p align="center"><img src="http://blog.neteril.org/wp-content/uploads/2010/05/2010-05-09-192712_355x375_scrot.png" alt="2010-05-09-192712_355x375_scrot" title="2010-05-09-192712_355x375_scrot" width="355" height="375" class="aligncenter size-full wp-image-920" /><br /><em>Loaded addins configuration</em></p>
<h4>Misc</h4>
<ul>
<li>Comic are shuffled randomly and served in a round-robin fashion to avoid duplicate fun</li>
<li>Zencomic haz a new icon</li>
<li>Repository has been autotool-ified so that you can directly and easily build from git master</li>
<li>Refactorised addin code</li>
</ul>
<p align="center"><img src="http://blog.neteril.org/wp-content/uploads/2010/05/zencomic_icon.png" alt="zencomic_icon" title="zencomic_icon" width="256" height="256" class="aligncenter size-full wp-image-925" /><br /><em>New icon with my poor artistic foo</em></p>
<h3>Download</h3>
<p>Tarball: <a href="http://neteril.org/projects/zencomic/zencomic-0.3.tar.gz">http://neteril.org/projects/zencomic/zencomic-0.3.tar.gz</a><br />
Git repository:  <a href="http://git.neteril.org/zencomic/">http://git.neteril.org/zencomic/</a</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2010/05/09/zencomic-0-3-holy-crepe/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PLinq is in</title>
		<link>http://blog.neteril.org/2010/04/17/plinq-is-in/</link>
		<comments>http://blog.neteril.org/2010/04/17/plinq-is-in/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 22:42:56 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.neteril.org/?p=889</guid>
		<description><![CDATA[At long last, PLinq has finally found its way into Mono trunk as what can be considered a preview release. The code has seen a major rewrite compared to the initial implementation done during earlier Google Summer of Code which lacked flexibility and correctness. Public API is complete except some operator still not implemented. In [...]]]></description>
			<content:encoded><![CDATA[<p align="center"><div id="attachment_890" class="wp-caption aligncenter" style="width: 517px"><a href="http://www.flickr.com/photos/ecstaticist/3055718118/"><img src="http://blog.neteril.org/wp-content/uploads/2010/04/header_plinq.jpg" alt="The Delta by ecstaticist under CC by-nc-sa" title="The Delta by ecstaticist under CC by-nc-sa" width="507" height="306" class="size-full wp-image-890" /></a><p class="wp-caption-text">It's all about splitting work</p></div></p>
<p>At long last, <a href="http://msdn.microsoft.com/en-us/library/dd460688(VS.100).aspx">PLinq</a> has finally <a href="http://twitter.com/migueldeicaza/status/12241543855">found its way into Mono trunk</a> as what can be considered a preview release. The code has seen a major rewrite compared to the initial implementation done during earlier Google Summer of Code which lacked flexibility and correctness.</p>
<p>Public API is complete except some operator still not implemented. In addition and as implied by the preview title, the current code hasn&#8217;t been tested against all possible flavor of query so it might or might not work for you (i.e. deadlock). If that&#8217;s the case, don&#8217;t hesitate to fill a bug report with a query reproducing the problem. The more query I have, the more robust we can shape future release.</p>
<p>By the way, these <a href="http://blog.neteril.org/2009/08/16/how-to-get-the-max-out-of-your-plinq-query/">PLinq performance tips</a> still hold true.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2010/04/17/plinq-is-in/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Wicd support patch for Banshee</title>
		<link>http://blog.neteril.org/2009/10/06/wicd-support-patch-for-banshee/</link>
		<comments>http://blog.neteril.org/2009/10/06/wicd-support-patch-for-banshee/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 21:25:38 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.neteril.org/?p=700</guid>
		<description><![CDATA[Shameless plug to tell I&#8217;m alive . If you are using Wicd and usually stare at Banshee trying to download cover art or post to last.fm while you are disconnected, the following patch add just the support to fix this. Here is the associated bug report to get the patch integrated. In other news, school [...]]]></description>
			<content:encoded><![CDATA[<p>Shameless plug to tell I&#8217;m alive <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
<p>If you are using <a href="http://wicd.sourceforge.net/">Wicd</a> and usually stare at Banshee trying to download cover art or post to last.fm while you are disconnected, <a href="http://neteril.org/mono/wicd-support.patch">the following patch</a> add just the support to fix this.</p>
<p>Here is the associated <a href="https://bugzilla.gnome.org/show_bug.cgi?id=596918">bug report</a> to get the patch integrated.</p>
<p>In other news, school restarted with its bunch of new responsibilities, limiting significantly free hacking time.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2009/10/06/wicd-support-patch-for-banshee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to get the max out of your PLinq query</title>
		<link>http://blog.neteril.org/2009/08/16/how-to-get-the-max-out-of-your-plinq-query/</link>
		<comments>http://blog.neteril.org/2009/08/16/how-to-get-the-max-out-of-your-plinq-query/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 17:34:15 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Google Summer of Code 2009]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blog.neteril.org/?p=685</guid>
		<description><![CDATA[Here are some tips you should follow if you want to get the maximum performance out of a Linq query parallelized with PLinq (at least with upcoming Mono version) : Use an indexed data structure as your source like an array, a list or anything which implements the generic IList&#60;T&#62; interface. You can also use [...]]]></description>
			<content:encoded><![CDATA[<p>Here are some tips you should follow if you want to get the maximum performance out of a Linq query parallelized with PLinq (at least with upcoming Mono version) :</p>
<ul>
<li>
<p>Use an indexed data structure as your source like an array, a list or anything which implements the generic IList&lt;T&gt; interface.</p>
<p>You can also use <a href="http://msdn.microsoft.com/en-us/library/dd268181%28VS.100%29.aspx">ParallelEnumerable.Repeat</a> and <a href="http://msdn.microsoft.com/en-us/library/system.linq.parallelenumerable.range%28VS.100%29.aspx">ParallelEnumerable.Range</a> as input. Notice the &#8216;Parallel&#8217; word in front as it&#8217;s not the same as Enumerable.(Range|Repeat)</p>
</li>
<li>
<p>Never use an ordering operator like OrderBy and never assume that the query should be ordered.</p>
<p>The overloads of some operator that provide an index integer are also to avoid.</p>
</li>
<li>
<p>As a general rule, try to stick to the general scheme of <a href="http://msdn.microsoft.com/en-us/library/dd383966%28VS.100%29.aspx">Select</a>-<a href="http://msdn.microsoft.com/en-us/library/dd384150%28VS.100%29.aspx">Where</a>-<a href="http://msdn.microsoft.com/en-us/library/dd383667%28VS.100%29.aspx">Aggregate</a> with any number of Select and Where (like the famous <a href="http://en.wikipedia.org/wiki/MapReduce">MapReduce</a>).</p>
<p>The syntactic sugar operators based on Aggregate like Min, Max, Average, etc&#8230; can also be used.</p>
</li>
<li>
<p>If you can manage it in your code, use the <a href="http://msdn.microsoft.com/en-us/library/dd383744%28VS.100%29.aspx">ForAll</a> method with an action delegate instead of iterating over the query with <code>foreach</code></p>
</li>
<li>
<p>Of course, forbid any synchronization (locks, semaphore, &#8230;) inside the operator selectors/predicates. The purest your lambdas are, the better.</p>
</li>
<li>
<p>The functions used with operators should be predictive and stable i.e. not depend on something uncertain time-wise like a network call and should yield approximately the same execution time with each input.</p>
<p>Sure, this is not always possible but if it is, it does prevent the engine from having to repeatedly balance the query execution itself.</p>
</li>
</ul>
<p>The <a href="http://msdn.microsoft.com/en-us/library/dd460688%28VS.100%29.aspx">PLinq MSDN page</a> contains some additional tricks and explanations if you are interested.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2009/08/16/how-to-get-the-max-out-of-your-plinq-query/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Follow-up on OpenVG support for Moonligh</title>
		<link>http://blog.neteril.org/2009/07/27/follow-up-on-openvg-support-for-moonlight/</link>
		<comments>http://blog.neteril.org/2009/07/27/follow-up-on-openvg-support-for-moonlight/#comments</comments>
		<pubDate>Mon, 27 Jul 2009 18:12:52 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://garuma.wordpress.com/?p=666</guid>
		<description><![CDATA[Interested by the stuff I demonstrated some weeks ago ? Check out the following message on Moonlight mailing-list for instructions on how to get the same thing. Just to make you salivate : www.youtube.com/watch?v=Ekfb6jCyDmM BubbleMark running at ~50 fps without too much visual glitches (direct link : http://www.youtube.com/watch?v=Ekfb6jCyDmM)]]></description>
			<content:encoded><![CDATA[<p>Interested by the stuff I <a href="http://garuma.wordpress.com/2009/07/16/joining-the-moonlight-fun/">demonstrated</a> some weeks ago ?</p>
<p>Check out the following <a href="http://lists.ximian.com/pipermail/moonlight-list/2009-July/000561.html">message</a> on Moonlight mailing-list for instructions on how to get the same thing.</p>
<p>Just to make you salivate :</p>
<p align="center"><span class="youtube">
<object width="425" height="355">
<param name="movie" value="http://www.youtube.com/v/Ekfb6jCyDmM?color1=d6d6d6&amp;color2=f0f0f0&amp;border=0&amp;fs=1&amp;hl=en&amp;loop=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0&amp;rel=1" />
<param name="allowFullScreen" value="true" />
<embed wmode="opaque" src="http://www.youtube.com/v/Ekfb6jCyDmM?color1=d6d6d6&amp;color2=f0f0f0&amp;border=0&amp;fs=1&amp;hl=en&amp;loop=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0&amp;rel=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="355"></embed>
<param name="wmode" value="opaque" />
</object>
</span><p><a href="http://www.youtube.com/watch?v=Ekfb6jCyDmM">www.youtube.com/watch?v=Ekfb6jCyDmM</a></p><br />
<br /><em>BubbleMark running at ~50 fps without too much visual glitches</em><br />
(direct link : <a href="http://www.youtube.com/watch?v=Ekfb6jCyDmM">http://www.youtube.com/watch?v=Ekfb6jCyDmM</a>)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2009/07/27/follow-up-on-openvg-support-for-moonlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Joining the Moonlight fun</title>
		<link>http://blog.neteril.org/2009/07/16/joining-the-moonlight-fun/</link>
		<comments>http://blog.neteril.org/2009/07/16/joining-the-moonlight-fun/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 15:07:17 +0000</pubDate>
		<dc:creator>Jérémie Laval</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://garuma.wordpress.com/?p=660</guid>
		<description><![CDATA[Watching my teammate hacking on moonlight was sure to detain on me someday. So when Alan talked about making Moonlight run on top of OpenVG I got pretty hooked. Two hacking days later, I actually got something to &#171;&#160;work&#160;&#187;. At the moment it&#8217;s quite rough, hacky and it probably kills kitteh too (be careful, it [...]]]></description>
			<content:encoded><![CDATA[<p>Watching my teammate hacking on moonlight was sure to detain on me someday. So when <a href="http://monotorrent.blogspot.com/">Alan</a> talked about making <a href="http://mono-project.com/Moonlight">Moonlight</a> run on top of <a href="http://en.wikipedia.org/wiki/OpenVG">OpenVG</a> I got pretty hooked.</p>
<p>Two hacking days later, I actually got something to &laquo;&nbsp;work&nbsp;&raquo;. At the moment it&#8217;s quite rough, hacky and it probably kills kitteh too (be careful, it makes shana angry, you wouldn&#8217;t like that).</p>
<p>Basically, what I did is to plug the OpenVG layer inside Moonlight custom version of cairo (using <a href="http://lists.cairographics.org/archives/cairo/2008-January/012833.html">that code</a> as a base) and then tweaked Moonlight to use the new surface (together with some changes in how drawing and caching is done internally).</p>
<p>Following is a screencast of the thing running <a href="http://bubblemark.com/silverlight2.html">Bubble Mark</a> :</p>
<p align="center"><span class="youtube">
<object width="425" height="355">
<param name="movie" value="http://www.youtube.com/v/dywInr08ySg?color1=d6d6d6&amp;color2=f0f0f0&amp;border=0&amp;fs=1&amp;hl=en&amp;loop=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0&amp;rel=1" />
<param name="allowFullScreen" value="true" />
<embed wmode="opaque" src="http://www.youtube.com/v/dywInr08ySg?color1=d6d6d6&amp;color2=f0f0f0&amp;border=0&amp;fs=1&amp;hl=en&amp;loop=&amp;showinfo=0&amp;iv_load_policy=3&amp;showsearch=0&amp;rel=1" type="application/x-shockwave-flash" allowfullscreen="true" width="425" height="355"></embed>
<param name="wmode" value="opaque" />
</object>
</span><p><a href="http://www.youtube.com/watch?v=dywInr08ySg">www.youtube.com/watch?v=dywInr08ySg</a></p><br />
<br />
(Direct link : <a href="http://www.youtube.com/watch?v=dywInr08ySg">http://www.youtube.com/watch?v=dywInr08ySg</a>)</p>
<p>As you can see there are a lot of drawing issues remaining but the basic stuff is here. The code is not terribly faster (+10 fps or so) but that may come either from a bug in my graphic card driver (it already does the bizarre thing of slowing down after some time) or an other part of Moonlight.</p>
<p>It will definitely be better when OpenVG becomes more widespread, has more optimized implementations and can actually run on its own rather than on top of OpenGL (I&#8217;m eager to try that on top of Gallium3D when it will be ready).</p>
<p>As for inclusion in the mainline tree, I don&#8217;t know. I mostly did the thing for fun as a proof-of-concept and it&#8217;s certainly far too crappy to ever get integrated as is, but maybe someone will step up and do it correctly later <img src='http://blog.neteril.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  .</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.neteril.org/2009/07/16/joining-the-moonlight-fun/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

