<?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>Florent Clairambault</title>
	<atom:link href="http://florent.clairambault.fr/feed" rel="self" type="application/rss+xml" />
	<link>http://florent.clairambault.fr</link>
	<description></description>
	<lastBuildDate>Thu, 11 Mar 2010 01:24:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0-alpha</generator>
		<item>
		<title>Six Sigma</title>
		<link>http://florent.clairambault.fr/six-sigma</link>
		<comments>http://florent.clairambault.fr/six-sigma#comments</comments>
		<pubDate>Wed, 10 Mar 2010 23:36:41 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[business management strategy]]></category>
		<category><![CDATA[six sigma]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2479</guid>
		<description><![CDATA[There&#8217;s a definition on wikipedia. It&#8217;s much much wider than my tiny vision of this business management strategy.
But basically this strategy says : Fix the source of every problem and not each problem. In a factory, it means that have to change the production process to reduce the probability of making defective pieces instead of [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a definition <a href="http://en.wikipedia.org/wiki/Six_Sigma">on wikipedia</a>. It&#8217;s much much wider than my tiny vision of this business management strategy.</p>
<p>But basically this strategy says : Fix the source of every problem and not each problem. In a factory, it means that have to change the production process to reduce the probability of making defective pieces instead of fixing pieces faster. That means you have to spend time on fixing the problem. So this stategy also means : <strong>Spend time to save time</strong>. <em>(I know bold formatting is evil but well&#8230; I&#8217;m evil sorry)</em></p>
<p>How that applies to me or you ? In fact everywhere. For me it can be seen as the creation of automated processes to replace some humanely driven processes. If you&#8217;ve already done a task twice and it can be optimized / automatized, then do it.</p>
<p>I&#8217;ve seen a lot of Sharepoint projects that would benefit of some &#8220;six sigma&#8221; thoughts. They often end up with a huge installation manual instead of optimizing the Sharepoint deployment package of each project.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/six-sigma/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux prioritization : do more with less</title>
		<link>http://florent.clairambault.fr/linux-prioritization-do-more-with-less</link>
		<comments>http://florent.clairambault.fr/linux-prioritization-do-more-with-less#comments</comments>
		<pubDate>Sun, 07 Mar 2010 18:34:04 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[cfq]]></category>
		<category><![CDATA[ionice]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[nice]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[prioritization]]></category>
		<category><![CDATA[real-time]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2452</guid>
		<description><![CDATA[I find the concept of prioritization very interesting. It just enables you to do more with less. Doesn&#8217;t that sound great ?
Let&#8217;s say you want to be able to respond to user requests as fast as possible but update your data in a low priority manner :
You can set the process CPU priority from -20 [...]]]></description>
			<content:encoded><![CDATA[<p>I find the concept of prioritization very interesting. It just enables you to do more with less. Doesn&#8217;t that sound great ?</p>
<p>Let&#8217;s say you want to be able to respond to user requests as fast as possible but update your data in a low priority manner :<br />
You can set the process CPU priority from -20 (high priority) to 19 (low priority) by using the command :</p>

<div class="wp_codebox"><table><tr id="p24526"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2452code6"><pre class="sh" style="font-family:monospace;">nice -n &lt;priority&gt; &lt;command&gt;</pre></td></tr></table></div>

<p>You can set the process IO priority in 4 classes (0: none, 1: realtime, 2: best-effort, 3: idle) with some priorities within these classes (0-7, lower being higher prio). But you have to enable the CFQ (Complete Fair Queueing) scheduler first by typing something like that :</p>

<div class="wp_codebox"><table><tr id="p24527"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2452code7"><pre class="sh" style="font-family:monospace;">echo cfq &gt;/sys/block/hda/queue/scheduler</pre></td></tr></table></div>

<p>So the ultimate low priority command will be</p>

<div class="wp_codebox"><table><tr id="p24528"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2452code8"><pre class="sh" style="font-family:monospace;">ionice -c 3 nice -n 20 &lt;command&gt;</pre></td></tr></table></div>

<p>But sometimes changing the CPU and IO priority won&#8217;t change much because the problem you might have might occur within the SQL server for say. So what you do ? Well, you could slow down your low priority program. If you have a low priority php script, you could do it like that :</p>

<div class="wp_codebox"><table><tr id="p24529"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p2452code9"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <a href="http://www.php.net/list"><span style="color: #990000;">list</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$load</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/proc/loadavg'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'sleeping '</span><span style="color: #339933;">.</span><span style="color: #000088;">$load</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
    <a href="http://www.php.net/usleep"><span style="color: #990000;">usleep</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$load</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">1000000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>This program will make a loop that will slow down with the increasing load. It means that this program will always keep space of the system, even if it&#8217;s run hundreads of time.</p>
<p>So yeah, you can now manage efficiently CPU and disk. Are you done ? Not really, there&#8217;s still the memory issue. Memory (RAM) is always fast unless there&#8217;s no memory left, then it&#8217;s paged and everything becomes thousand times slower. You can only disable the virtual memory (swap on Linux), set some memory allocation limits (with ulimit), but that&#8217;s pretty much it.<br />
I would personnally recommend to disable swap and always take more RAM than needed. On servers swap prevent them from having to kill process, but they are so much slowed by it that the whole system is slowed down. And then even ssh server is so slow you have an ssh timeout before reaching the shell.</p>
<p>So, Linux has a great scheduling capacity. But what about NOT scheduling ? Well, Linux is also great like with that. You can put some process in real-time mode, these processes won&#8217;t be interupted by anything unless they are sleeping or waiting for an I/O event.<br />
You can use the Real-Time (RT) mode using the rtprio command :</p>

<div class="wp_codebox"><table><tr id="p245210"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2452code10"><pre class="sh" style="font-family:monospace;">rtprio 99 &lt;command&gt;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/linux-prioritization-do-more-with-less/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stupid C++ vs C# performance comparison</title>
		<link>http://florent.clairambault.fr/stupid-cpp-vs-charp-performance-comparison</link>
		<comments>http://florent.clairambault.fr/stupid-cpp-vs-charp-performance-comparison#comments</comments>
		<pubDate>Fri, 26 Feb 2010 20:00:35 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[C# .Net]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[g++]]></category>
		<category><![CDATA[gmcs]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mono]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2409</guid>
		<description><![CDATA[I recently did a simple and stupid comparison test between C++ (g++) and C# .Net (mono).
My point here is that C# can actually be considered as a very fast (as fast as C++) language. It allows automatic hardware-specific optimization.
Lot of people think it&#8217;s like a java, it has a virtual machine. But in fact it [...]]]></description>
			<content:encoded><![CDATA[<p>I recently did a simple and stupid comparison test between C++ (g++) and C# .Net (mono).</p>
<p>My point here is that C# can actually be considered as a very fast (as fast as C++) language. It allows automatic hardware-specific optimization.<br />
Lot of people think it&#8217;s like a java, it has a virtual machine. But in fact it just compiles everything into native language when it accesses methods. This is the whole purpose of the JIT (Just Int Time compiler).</p>
<p>If you feel the JIT compiler is a possible reason of slowness (it slows down the program startup), you can pre-compile your assemblys (mono &#8211;aot on linux). If you feel the mono files are a drawback, you can bundle everything in one file using mkbundle. You can read more about this <a href="http://www.mono-project.com/Guide:Running_Mono_Applications">here</a>.</p>
<p>The only real drawback you have in the .Net framework is the garbage collector. It prevents the C# .Net it from being a realtime language/framework. But in real life usage it doesn&#8217;t slow anything down.</p>
<p>The purpose of the following test is to show that C# isn&#8217;t slower than C++. But if you&#8217;re searching for arguments to choose C# .Net over native C++, you should also consider this :</p>
<ul>
<li>Mono (and presumely the .Net framework) does some really interesting optimizations :

<div class="wp_codebox"><table><tr id="p240920"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2409code20"><pre class="sh" style="font-family:monospace;"># mono --list-opt</pre></td></tr></table></div>

<p>I put some link so that you can learn about these really interesting optimization. This is like design patterns, you should really know these things.</em></p>
<table>
<tr>
<td>peephole</td>
<td><a href="http://en.wikipedia.org/wiki/Peephole_optimization">Peephole postpass</a></td>
</tr>
<tr>
<td>branch</td>
<td><a href="http://www.compileroptimizations.com/category/branch_optimization.htm">Branch optimizations</a></td>
</tr>
<tr>
<td>inline</td>
<td><a href="http://dotnetperls.com/inline-optimization">Inline method calls</a></td>
</tr>
<tr>
<td>cfold</td>
<td><a href="http://www.nullstone.com/htmls/category/consfold.htm">Constant folding</a></td>
</tr>
<tr>
<td>consprop</td>
<td><a href="http://en.wikipedia.org/wiki/Constant_folding#Constant_propagation">Constant propagation</a></td>
</tr>
<tr>
<td>copyprop</td>
<td><a href="http://en.wikipedia.org/wiki/Copy_propagation">Copy propagation</a></td>
</tr>
<tr>
<td>deadce</td>
<td><a href="http://en.wikipedia.org/wiki/Dead_code_elimination">Dead code elimination</a></td>
</tr>
<tr>
<td>linears</td>
<td><a href="http://en.wikipedia.org/wiki/Register_allocation">Linear scan global reg allocation</a></td>
</tr>
<tr>
<td>cmov</td>
<td><a href="http://assemblyrequired.crashworks.org/2009/01/04/fcmp-conditional-moves-for-branchless-math/">Conditional moves</a></td>
</tr>
<tr>
<td>shared</td>
<td>Emit per-domain code</td>
</tr>
<tr>
<td>sched</td>
<td><a href="http://en.wikipedia.org/wiki/Instruction_scheduling">Instruction scheduling</a></td>
</tr>
<tr>
<td>intrins</td>
<td>Intrinsic method implementations</td>
</tr>
<tr>
<td>tailc</td>
<td><a href="http://en.wikipedia.org/wiki/Tail_recursion">Tail recursion and tail calls</a></td>
</tr>
<tr>
<td>loop</td>
<td><a href="http://en.wikipedia.org/wiki/Loop_optimization">Loop related optimizations</a></td>
</tr>
<tr>
<td>fcmov</td>
<td><a href="http://en.wikipedia.org/wiki/FCMOV">Fast x86 FP compares</a></td>
</tr>
<tr>
<td>leaf</td>
<td><a href="http://moby.cs.uchicago.edu/documentation/HTML/ImplNotes/report011.html#htoc82">Leaf procedures optimizations</a></td>
</tr>
<tr>
<td>aot</td>
<td><a href="http://www.mono-project.com/AOT">Usage of Ahead Of Time compiled code</a></td>
</tr>
<tr>
<td>precomp</td>
<td>Precompile all methods before executing Main</td>
</tr>
<tr>
<td>abcrem</td>
<td><a href="http://blogs.msdn.com/clrcodegeneration/archive/2009/08/13/array-bounds-check-elimination-in-the-clr.aspx">Array bound checks removal</a></td>
</tr>
<tr>
<td>ssapre</td>
<td><a href="http://en.wikipedia.org/wiki/Partial_redundancy_elimination">SSA based Partial Redundancy Elimination</a></td>
</tr>
<tr>
<td>exception</td>
<td><a href="http://stackoverflow.com/questions/1108050/does-the-net-jit-optimize-nested-try-catch-statements">Optimize exception catch blocks</a></td>
</tr>
<tr>
<td>ssa</td>
<td><a href="http://en.wikipedia.org/wiki/Static_single_assignment_form">Use plain SSA form</a></td>
</tr>
<tr>
<td>treeprop</td>
<td>Tree propagation</td>
</tr>
<tr>
<td>sse2</td>
<td><a href="http://en.wikipedia.org/wiki/SSE2">SSE2 instructions on x86</a></td>
</tr>
<tr>
<td>gshared</td>
<td>Share generics</td>
</tr>
<tr>
<td>simd</td>
<td><a href="http://en.wikipedia.org/wiki/SIMD">Simd intrinsics</a></td>
</tr>
</table>
</li>
<li>Multithreading in .net is much easier than any other language. You even have the parrallel loop (like <a href="http://www.lovethedot.net/2009/02/parallelfor-deeper-dive-parallel.html">Parallel.For</a> operations.</li>
</ul>
<p><strong>SO ! Here is the test&#8230;</strong></p>
<p>I wrote these two sample programs :</p>
<p>One in C++ :</p>

<div class="wp_codebox"><table><tr id="p240921"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
</pre></td><td class="code" id="p2409code21"><pre class="cpp" style="font-family:monospace;"><span style="color: #339900;">#include &lt;iostream&gt;</span>
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> std<span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">long</span> stupidThing<span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">long</span> nb <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">long</span> out <span style="color: #000080;">=</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span>
	<span style="color: #0000ff;">while</span><span style="color: #008000;">&#40;</span> nb <span style="color: #000080;">&gt;</span> <span style="color: #0000dd;">0</span> <span style="color: #008000;">&#41;</span>
		out <span style="color: #000040;">*</span><span style="color: #000080;">=</span> nb<span style="color: #000040;">--</span><span style="color: #008080;">;</span>
&nbsp;
&nbsp;
	<span style="color: #0000ff;">return</span> out<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
&nbsp;
	<span style="color: #0000ff;">long</span> total <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">int</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">1000000</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>i <span style="color: #008000;">&#41;</span>
		<span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span> <span style="color: #0000ff;">long</span> l <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> l <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">100</span><span style="color: #008080;">;</span> <span style="color: #000040;">++</span>l <span style="color: #008000;">&#41;</span>
			total <span style="color: #000040;">+</span><span style="color: #000080;">=</span> stupidThing<span style="color: #008000;">&#40;</span> l <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;&lt;</span> <span style="color: #FF0000;">&quot;Total : &quot;</span> <span style="color: #000080;">&lt;&lt;</span> total <span style="color: #000080;">&lt;&lt;</span> endl<span style="color: #008080;">;</span>
&nbsp;
	<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>One in C# :</p>

<div class="wp_codebox"><table><tr id="p240922"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code" id="p2409code22"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> test <span style="color: #008000;">&#123;</span>
        <span style="color: #6666cc; font-weight: bold;">class</span> Program <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">long</span> stupidThing<span style="color: #008000;">&#40;</span> <span style="color: #6666cc; font-weight: bold;">long</span> nb <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                        <span style="color: #6666cc; font-weight: bold;">long</span> ret <span style="color: #008000;">=</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
                        <span style="color: #0600FF; font-weight: bold;">while</span> <span style="color: #008000;">&#40;</span> nb <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span> <span style="color: #008000;">&#41;</span>
                                ret <span style="color: #008000;">*=</span> nb<span style="color: #008000;">--;</span>
                        <span style="color: #0600FF; font-weight: bold;">return</span> ret<span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span> <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> args <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
&nbsp;
                        <span style="color: #6666cc; font-weight: bold;">long</span> total <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
&nbsp;
                        <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span> <span style="color: #6666cc; font-weight: bold;">int</span> i <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> i <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">1000000</span><span style="color: #008000;">;</span> <span style="color: #008000;">++</span>i <span style="color: #008000;">&#41;</span>
                                <span style="color: #0600FF; font-weight: bold;">for</span> <span style="color: #008000;">&#40;</span> <span style="color: #6666cc; font-weight: bold;">long</span> l <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> l <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">100</span><span style="color: #008000;">;</span> <span style="color: #008000;">++</span>l <span style="color: #008000;">&#41;</span>
                                        total <span style="color: #008000;">+=</span> stupidThing<span style="color: #008000;">&#40;</span> l <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                        Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span> <span style="color: #666666;">&quot;Total : {0}&quot;</span>, total <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>First of all, I open a shell in real-time priority, because I don&#8217;t want my other processses to mess with my tests :</p>

<div class="wp_codebox"><table><tr id="p240923"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2409code23"><pre class="sh" style="font-family:monospace;"># rtprio 99 bash</pre></td></tr></table></div>

<p>Then I compile the two programs :</p>

<div class="wp_codebox"><table><tr id="p240924"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2409code24"><pre class="sh" style="font-family:monospace;"># gmcs test.cs
# g++ -O4 test.cpp -o test</pre></td></tr></table></div>

<p>And then I launch my test :</p>
<p>On a 64 bits host :</p>

<div class="wp_codebox"><table><tr id="p240925"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2409code25"><pre class="txt" style="font-family:monospace;">Kernel : 2.6.9-023stab051.3-smp #1 SMP Wed Nov 4 18:36:34 MSK 2009 x86_64 x86_64 x86_64 GNU/Linux</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p240926"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code" id="p2409code26"><pre class="sh" style="font-family:monospace;"># time ./test ; time ./test ; time ./test ; time mono test.exe ; time mono test.exe ; time mono test.exe
Total : -6192109806162068864
&nbsp;
real    0m12.433s
user    0m12.394s
sys     0m0.049s
Total : -6192109806162068864
&nbsp;
real    0m12.415s
user    0m12.411s
sys     0m0.014s
Total : -6192109806162068864
&nbsp;
real    0m12.430s
user    0m12.411s
sys     0m0.026s
Total : -6192109806162068864
&nbsp;
real    0m10.311s
user    0m10.287s
sys     0m0.029s
Total : -6192109806162068864
&nbsp;
real    0m10.254s
user    0m10.247s
sys     0m0.011s
Total : -6192109806162068864
&nbsp;
real    0m10.250s
user    0m10.255s
sys     0m0.012s</pre></td></tr></table></div>

<p>C# clearly beats C++ here. Well</p>
<p>On a 32 bits host :</p>

<div class="wp_codebox"><table><tr id="p240927"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p2409code27"><pre class="txt" style="font-family:monospace;">Kernel : 2.6.30-2-686 #1 SMP Fri Dec 4 00:53:20 UTC 2009 i686 GNU/Linux</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p240928"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
</pre></td><td class="code" id="p2409code28"><pre class="sh" style="font-family:monospace;"># time ./test ; time ./test ; time ./test ; time mono test.exe ; time mono test.exe ; time mono test.exe
Total : 100461056
&nbsp;
real    1m10.927s
user    1m7.376s
sys     0m0.056s
Total : 100461056
&nbsp;
real    1m12.590s
user    1m8.976s
sys     0m0.020s
Total : 100461056
&nbsp;
real    1m13.279s
user    1m9.532s
sys     0m0.056s
Total : -6192109806162068864
&nbsp;
real    2m22.492s
user    2m15.260s
sys     0m0.136s
Total : -6192109806162068864
&nbsp;
real    2m23.002s
user    2m15.760s
sys     0m0.104s
Total : -6192109806162068864
&nbsp;
real    2m25.102s
user    2m17.709s
sys     0m0.144s</pre></td></tr></table></div>

<p>C++ beats C# here, but in 32 bits C++ use other types whereas C# use the same. In C# long is always 64 bits, in C++ it can be 64 bits or 32 bits (depending on the current architecture).</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/stupid-cpp-vs-charp-performance-comparison/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>D language</title>
		<link>http://florent.clairambault.fr/d-language</link>
		<comments>http://florent.clairambault.fr/d-language#comments</comments>
		<pubDate>Thu, 25 Feb 2010 21:57:40 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[C# .Net]]></category>
		<category><![CDATA[D language]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2406</guid>
		<description><![CDATA[This is just a very short post about this language I recently discovered : the D language. As described on its little website : &#8220;D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a very short post about this language I recently discovered : the D language. As described on <a href="http://www.d-programming-language.org/">its little website</a> : &#8220;D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. Special attention is given to the needs of quality assurance, documentation, management, portability and reliability.&#8221;.</p>
<p>It has most of the features of the java and the C# (best language ever), but it is fully compiled (no JVM or JIT stuff).</p>
<p>You should have a quick loot of its features on the <a href="http://www.digitalmars.com/d/">Digital mars website</a> (they&#8217;re the who made it).</p>
<p>I wonder if this language really has a future. C# (with the .Net framework) compiles and runs on every platform (thanks to <a href="http://www.mono-project.com/">mono</a>), even <a href="http://monotouch.net/">on the iPhone</a>, so it only remove the burden of the libraries required to run .net apps.<br />
So, will it really beats its performance ? Because in C# is very fast (my next post will bring a stupid C++/C# performance comparison), and in C# avoiding time or memory consuming mistakes or multi-threading our code is very easy.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/d-language/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SPSecurity.RunWithElevatedPrivileges</title>
		<link>http://florent.clairambault.fr/spsecurity-runwithelevatedprivileges</link>
		<comments>http://florent.clairambault.fr/spsecurity-runwithelevatedprivileges#comments</comments>
		<pubDate>Mon, 22 Feb 2010 20:00:56 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[C# .Net]]></category>
		<category><![CDATA[Sharepoint]]></category>
		<category><![CDATA[SPSite]]></category>
		<category><![CDATA[SPWeb]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2303</guid>
		<description><![CDATA[If like me you&#8217;re wondering what exactly does SPSecurity.RunWithElevatedPrivileges, this is what I understand of it :

1
2
3
4
5
SPSecurity.RunWithElevatedPrivileges&#40; &#40;&#41; =&#62; &#123;
    using&#40; var newSite = new SPSite&#40; site.Url &#41; &#41; &#123;
        // your stuff
    &#125;
&#125;&#41;;

Is equivalent to :

1
2
3
using&#40; var newSite = new SPSite&#40; [...]]]></description>
			<content:encoded><![CDATA[<p>If like me you&#8217;re wondering what exactly does SPSecurity.RunWithElevatedPrivileges, this is what I understand of it :</p>

<div class="wp_codebox"><table><tr id="p230331"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p2303code31"><pre class="csharp" style="font-family:monospace;">SPSecurity<span style="color: #008000;">.</span><span style="color: #0000FF;">RunWithElevatedPrivileges</span><span style="color: #008000;">&#40;</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">=&gt;</span> <span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">using</span><span style="color: #008000;">&#40;</span> var newSite <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> SPSite<span style="color: #008000;">&#40;</span> site<span style="color: #008000;">.</span><span style="color: #0000FF;">Url</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        <span style="color: #008080; font-style: italic;">// your stuff</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>Is equivalent to :</p>

<div class="wp_codebox"><table><tr id="p230332"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p2303code32"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span><span style="color: #008000;">&#40;</span> var newSite <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> SPSite<span style="color: #008000;">&#40;</span> site<span style="color: #008000;">.</span><span style="color: #0000FF;">Url</span>, site<span style="color: #008000;">.</span><span style="color: #0000FF;">SystemAccount</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Token</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
    <span style="color: #008080; font-style: italic;">// your stuff</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>So if this is just to open an elevated privilege SPSite, it will be equivalent. But if you do some more complex things, as soon as you load a new SPSite it will open it with the original UserToken. And you lose&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/spsecurity-runwithelevatedprivileges/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# .Net : How works automatic assembly versioning</title>
		<link>http://florent.clairambault.fr/c-net-how-works-automatic-assembly-versioning</link>
		<comments>http://florent.clairambault.fr/c-net-how-works-automatic-assembly-versioning#comments</comments>
		<pubDate>Sun, 21 Feb 2010 12:02:01 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[assembly versions]]></category>
		<category><![CDATA[C# .Net]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2388</guid>
		<description><![CDATA[When you choose to automatically generate a new version of your assembly at compilation, you have to set in the AssemblyInfo.cs file, this line :

1
2
3
4
5
6
7
8
9
10
// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version 
//     [...]]]></description>
			<content:encoded><![CDATA[<p>When you choose to automatically generate a new version of your assembly at compilation, you have to set in the AssemblyInfo.cs file, this line :</p>

<div class="wp_codebox"><table><tr id="p238835"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p2388code35"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// Version information for an assembly consists of the following four values:</span>
<span style="color: #008080; font-style: italic;">//</span>
<span style="color: #008080; font-style: italic;">//      Major Version</span>
<span style="color: #008080; font-style: italic;">//      Minor Version </span>
<span style="color: #008080; font-style: italic;">//      Build Number</span>
<span style="color: #008080; font-style: italic;">//      Revision</span>
<span style="color: #008080; font-style: italic;">//</span>
<span style="color: #008080; font-style: italic;">// You can specify all the values or you can default the Build and Revision Numbers </span>
<span style="color: #008080; font-style: italic;">// by using the '*' as shown below:</span>
<span style="color: #008000;">&#91;</span>assembly<span style="color: #008000;">:</span> AssemblyVersion<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;1.0.*&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span></pre></td></tr></table></div>

<p>But what do these automatically generated numbers mean ? Well, chances are you don&#8217;t care. But one day after using this features for years I decided that I would.</p>
<ul>
<li>The build number is the number of days since 01/01/2000</li>
<li>The revision number if the number of 2 seconds periods since 00:00 of this day</li>
</ul>
<p>So&#8230; To get the compilation date of an assembly from its version, you would have to do :</p>

<div class="wp_codebox"><table><tr id="p238836"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p2388code36"><pre class="csharp" style="font-family:monospace;">var version <span style="color: #008000;">=</span> Assembly<span style="color: #008000;">.</span><span style="color: #0000FF;">GetExecutingAssembly</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetName</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Version</span><span style="color: #008000;">;</span>
var date <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> DateTime<span style="color: #008000;">&#40;</span> <span style="color: #FF0000;">2000</span>, 01, 01 <span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AddDays</span><span style="color: #008000;">&#40;</span> version<span style="color: #008000;">.</span><span style="color: #0000FF;">Build</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AddSeconds</span><span style="color: #008000;">&#40;</span> version<span style="color: #008000;">.</span><span style="color: #0000FF;">Revision</span> <span style="color: #008000;">*</span> <span style="color: #FF0000;">2</span> <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></td></tr></table></div>

<p>This feature is great if your need some atomic versionning of a particular library for instance. Each program using your library has its own version and you don&#8217;t risk to break working feature in future release of your library. And if you want to force the use of a newer version of a library within a particular application, you can use some <a href="http://msdn.microsoft.com/en-us/library/7wd6ex19(VS.71).aspx">assembly redirection</a>.<br />
But you should also note that if you deploy your assembly in the <a href="/tag/GAC">GAC</a> (like it&#8217;s required to do with Sharepoint), you will have tons of &#8220;garbage&#8221; versions of your assembly. And there&#8217;s not &#8220;easy fix&#8221; for that.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/c-net-how-works-automatic-assembly-versioning/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Threads and Sharepoint</title>
		<link>http://florent.clairambault.fr/threads-and-sharepoint</link>
		<comments>http://florent.clairambault.fr/threads-and-sharepoint#comments</comments>
		<pubDate>Sat, 20 Feb 2010 08:00:31 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[multithreading]]></category>
		<category><![CDATA[Sharepoint]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2321</guid>
		<description><![CDATA[When you are using threads on sharepoint, you should take care of some little things :

The method used to launch the thread must have the &#8220;[STAThread]&#8221; attribute, it avoids some huge memory leaks.
If you need to use an SPSite from the calling site, you should copy its URL and UserToken to build a new SPSite [...]]]></description>
			<content:encoded><![CDATA[<p>When you are using threads on sharepoint, you should take care of some little things :</p>
<ul>
<li>The method used to launch the thread must have the &#8220;[STAThread]&#8221; attribute, it avoids some huge memory leaks.</li>
<li>If you need to use an SPSite from the calling site, you should copy its URL and UserToken to build a new SPSite in the new thread. If you&#8217;re not using that &#8220;design pattern&#8221;, things will get really wrong.</li>
<li>And of course you should dispose any sharepoint SPSite (SPWebs come from SPSite) allocated within the thread.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/threads-and-sharepoint/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FSBL &#8211; Freestyle Basic Script Language</title>
		<link>http://florent.clairambault.fr/fsbl-freestyle-basic-script-language</link>
		<comments>http://florent.clairambault.fr/fsbl-freestyle-basic-script-language#comments</comments>
		<pubDate>Thu, 18 Feb 2010 23:58:04 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[FSBL]]></category>
		<category><![CDATA[Gerôme Guillemin]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2380</guid>
		<description><![CDATA[I met Gerôme Guillemin at work (well yes his personal page is totally outdated). He invented and supported this language, its surrounding development tools and some sample programs.
What is quite amazing with this script language is that it only requires a simple 450 KB exe file to run the FSBL scripts and all scripts perform [...]]]></description>
			<content:encoded><![CDATA[<p>I met <a href="http://gedd123.free.fr/theidx.html">Gerôme Guillemin</a> at work (well yes his personal page is totally outdated). He invented and supported <a href="http://www.fbsl.net/homepage.html">this language</a>, its surrounding development tools and some sample programs.</p>
<p>What is quite amazing with this script language is that it only requires a simple 450 KB exe file to run the FSBL scripts and all scripts perform very well (even with the OpenGL samples). The executed programs look like they are some native Win32 applications.</p>
<p>You can get the <a href="http://www.softpedia.com/get/Programming/Coding-languages-Compilers/FBSL-Freestyle-Basic-Script-Language.shtml">3.32.2 version installer here</a>.</p>
<p>The program is closed source but he&#8217;s ok to give the sources to people ready to get involved in the project.</p>
<p>By the way, <a href="http://www.facebook.com/gerome.guillemin">Gerôme Guillemin</a> is the first person I know to have played with the <a href="http://calculators.torensma.net/index.php?page.id=16&#038;calculator.id=597">TI-74</a>. I&#8217;ve spent a lot of time with this amazing single line calculator that my father owns.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/fsbl-freestyle-basic-script-language/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rue Du Fric</title>
		<link>http://florent.clairambault.fr/rue-du-fric</link>
		<comments>http://florent.clairambault.fr/rue-du-fric#comments</comments>
		<pubDate>Tue, 16 Feb 2010 06:00:05 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[French]]></category>
		<category><![CDATA[beemoov]]></category>
		<category><![CDATA[Rue Du Fric]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2367</guid>
		<description><![CDATA[
For my english readers, you&#8217;re out of luck, this is a french-only post because it&#8217;s about a french online game : Rue Du Fric (can be translated to &#8220;street of money&#8221;, or maybe &#8220;street of gold&#8221;). But you can still have a look at the game if you&#8217;re interested.

Le jeu Rue Du Fric développé par [...]]]></description>
			<content:encoded><![CDATA[<p><em><br />
For my english readers, you&#8217;re out of luck, this is a french-only post because it&#8217;s about a french online game : <a href="http://www.ruedufric.com">Rue Du Fric</a> (can be translated to &#8220;street of money&#8221;, or maybe &#8220;street of gold&#8221;). But you can still have a look at the game if you&#8217;re interested.<br />
</em></p>
<p>Le jeu <a href="http://www.ruedufric.com/demo.html">Rue Du Fric</a> développé par la jeune startup <a href="http://www.beemoov.com/">BeeMoov</a> est un jeu 100% javascript + AJAX. Il est très bien fini, il repose un univers extensible &#8220;à l&#8217;infini&#8221; au fur et à mesure de l&#8217;arrivée de nouveaux joueurs et l&#8217;occupation des sols. Vous pouvez acheter du terrain, placer des maisons dessus, gagner de l&#8217;argent, vendre et acheter des biens aux membres ou aux enchères, emprunter de l&#8217;argent à la banque et tout ça en interagissant en continu avec les autres. </p>
<p>Le jeu vient de démarrer, l&#8217;univers est déjà pas mal occupé avec une belle étendue de terrain couverte. Si vous êtes un geek, allez apprécier la prouesse technique et filez l&#8217;adresse à vos amis. Pour les autres, testez et éclatez vous.</p>
<p>BeeMoov a lancé il y a quelques années <a href="http://www.ma-bimbo.com/">Ma Bimbo</a> dont le succès ne se dément plus.</p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/rue-du-fric/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I love Google Buzz</title>
		<link>http://florent.clairambault.fr/i-love-google-buzz</link>
		<comments>http://florent.clairambault.fr/i-love-google-buzz#comments</comments>
		<pubDate>Mon, 15 Feb 2010 20:00:22 +0000</pubDate>
		<dc:creator>Florent Clairambault</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Buzz]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://florent.clairambault.fr/?p=2358</guid>
		<description><![CDATA[I have played with Google Buzz on the web and on Google Maps 4.0. I&#8217;ve always been a huge fan of location based services, Google Maps w/Buzz is the ultimate one. 
I like the world Google is building for us. There&#8217;s soo much data they allow us to access and build around everything.

Not related in [...]]]></description>
			<content:encoded><![CDATA[<p>I have played with Google Buzz on the web and on Google Maps 4.0. I&#8217;ve always been a huge fan of location based services, Google Maps w/Buzz is the ultimate one. </p>
<p>I like the world Google is building for us. There&#8217;s soo much data they allow us to access and build around everything.</p>
<p><del datetime="2010-02-15T01:22:45+00:00"><br />
Not related in anyway note : but well as nobody&#8217;s reading (even my girlfriend, isn&#8217;t that sad), I guess I can say useless things : I discovered the perfect &#8220;computer guy&#8221;&#8217;s girlfriend : Leah Culver. She is <a href="http://images.google.com/images?q=leah+culver">pretty</a>, <a href="http://www.crunchbase.com/person/leah-culver">smart</a>, <a href="http://blog.leahculver.com/about.html">loves to code</a> and she even likes <a href="http://leahculver.com/leah.png">hamburgers</a>. And she doesn&#8217;t seem disturbed by <a href="http://leahculver.com/images/google-street-view-jetta.png">crappy cars</a>.<br />
There must be something wrong with this girl, maybe she&#8217;s a <a href="http://en.wikipedia.org/wiki/The_Succubus">succubus from hell</a>.<br />
I reached my quota of useless links.</del></p>
]]></content:encoded>
			<wfw:commentRss>http://florent.clairambault.fr/i-love-google-buzz/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.469 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-03-11 03:35:14 -->
