<?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>Huddled Masses &#187; Recursion</title>
	<atom:link href="http://huddledmasses.org/tag/recursion/feed/" rel="self" type="application/rss+xml" />
	<link>http://huddledmasses.org</link>
	<description>You can do more than breathe for free...</description>
	<lastBuildDate>Sat, 28 Jan 2012 21:37:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<cloud domain='huddledmasses.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Eight Queens in PowerShell</title>
		<link>http://huddledmasses.org/eight-queens-in-powershell/</link>
		<comments>http://huddledmasses.org/eight-queens-in-powershell/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 03:46:31 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[Algorithms]]></category>
		<category><![CDATA[Backtracking]]></category>
		<category><![CDATA[Challenges]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Recursion]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/eight-queens-in-powershell/</guid>
		<description><![CDATA[Well &#8230; my brother called me with an odd compiler problem with his C++ homework today (he&#8217;s working on another degree, and taking some programming courses) ... but the homework problem he was working on was the infamous N Queens problem: Given a chess board of N x N squares, place N queens on the [...]]]></description>
			<content:encoded><![CDATA[	<p>Well &#8230; my brother called me with an odd compiler problem with his C++ homework today (he&#8217;s working on another degree, and taking some programming courses) ... but the homework problem he was working on was the infamous N Queens problem: </p>

	<blockquote>
		<p>Given a chess board of N x N squares, place N queens on the board in such a way than none threatens the others. In chess, a queen can move diagonally or horizontally, so solving this requires placing each queen on her own row and column, and ordered such that none of them are on the same diagonal in either direction.</p>
	</blockquote>

	<p>The problem is solvable using a backtracking recursive algorithm: the program must place a queen on the first row and then find a spot that works for the next row, and continue for each row.  If it can&#8217;t find a spot for a row, it backtracks to the previous row and uses the next legal spot on that row, and if there is none, it backtracks to the previous row, and so on.</p>

	<p>Anyway. There&#8217;s lots of information about this stuff out there on the &#8216;net, including dozens of slides shows and lecture notes from dozens of schools, so I&#8217;m just going to move on to the fun part: my solution in PowerShell. I wrote it just to make sure I understood the algorithm correctly, without giving away the C++ answer as much as a quick web search would. In fact, I followed the restrictions my brother&#8217;s professor had placed on them to break it up into a specific set of functions&#8230;</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #666666; font-style: italic;">## N-Queens problem using backtracking</span><br />
<span style="color: #666666; font-style: italic;">################################################################################</span><br />
<span style="color: #666666; font-style: italic;">## Backtracking is a problem-solving strategy that, when it reaches an impasse, </span><br />
<span style="color: #666666; font-style: italic;">## retraces its steps in reverse order before trying a new sequence of steps.</span><br />
<br />
<span style="color: #666699; font-weight: bold;">param</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$size</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">8</span><span style="color: #333;">&#41;</span> &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># By default, we use a board of size 8</span><br />
<br />
<span style="color: #666699; font-weight: bold;">function</span> Check<span style="color: #66cc66;">-</span>Queen<span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$r1</span>,<span style="color: #660033; font-weight: bold;">$c1</span>,<span style="color: #660033; font-weight: bold;">$r2</span>,<span style="color: #660033; font-weight: bold;">$c2</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">return</span> <span style="color: #000066;">-not</span> <span style="color: #333;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># they can't be on the same column</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$c1</span> <span style="color: #000066;">-eq</span> <span style="color: #660033; font-weight: bold;">$c2</span><span style="color: #333;">&#41;</span> <span style="color: #000066;">-or</span> <br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># nor on the same row</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$r1</span> <span style="color: #000066;">-eq</span> <span style="color: #660033; font-weight: bold;">$r2</span><span style="color: #333;">&#41;</span> <span style="color: #000066;">-or</span> <br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># nor on the same diagonal</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #333;">&#40;</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span>Math<span style="color: #333;">&#93;</span></span>::<span style="color: #003366;">Abs</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$r1</span><span style="color: #66cc66;">-</span><span style="color: #660033; font-weight: bold;">$r2</span><span style="color: #333;">&#41;</span> <span style="color: #000066;">-eq</span> <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span>Math<span style="color: #333;">&#93;</span></span>::<span style="color: #003366;">Abs</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$c1</span><span style="color: #66cc66;">-</span><span style="color: #660033; font-weight: bold;">$c2</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#41;</span>;<br />
<span style="color: #333;">&#125;</span><br />
<br />
<span style="color: #666699; font-weight: bold;">function</span> <span style="color: #0066cc; font-style: italic;">Out-<span style="font-style: normal;">Board</span></span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$board</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">foreach</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$c</span> <span style="color: #666699; font-weight: bold;">in</span> <span style="color: #660033; font-weight: bold;">$board</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">switch</span><span style="color: #333;">&#40;</span>0..<span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$board</span>.<span style="color: #003366;">Count</span><span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #333;">&#123;</span><span style="color: #660033; font-weight: bold;">$_</span><span style="color: #66cc66;">-</span><span style="color: #333399; font-weight: bold; font-style: italic;">eq</span><span style="color: #660033; font-weight: bold;">$c</span><span style="color: #333;">&#125;</span> <span style="color: #333;">&#123;</span> <span style="color: #0066cc; font-style: italic;">write-<span style="font-style: normal;">host</span></span> <span style="color: #009900;">&quot;Q&quot;</span> <span style="color: #000066;">-fore</span> red <span style="color: #000066;">-nonew</span> <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; default &nbsp; <span style="color: #333;">&#123;</span> <span style="color: #0066cc; font-style: italic;">write-<span style="font-style: normal;">host</span></span> <span style="color: #009900;">&quot;#&quot;</span> <span style="color: #000066;">-nonew</span><span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0066cc; font-style: italic;">Write-<span style="font-style: normal;">Host</span></span><br />
&nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
<span style="color: #333;">&#125;</span><br />
<br />
<span style="color: #666699; font-weight: bold;">function</span> <span style="color: #0066cc; font-style: italic;">Set-<span style="font-style: normal;">Queen</span></span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$board</span>,<span style="color: #660033; font-weight: bold;">$row</span>,<span style="color: #660033; font-weight: bold;">$column</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Set the queen location for this row</span><br />
&nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$board</span><span style="color: #333;">&#91;</span><span style="color: #660033; font-weight: bold;">$row</span><span style="color: #333;">&#93;</span><span style="color: #66cc66;">=</span><span style="color: #660033; font-weight: bold;">$column</span>;<br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># if this is the last row, then we're done</span><br />
&nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$row</span><span style="color: #66cc66;">+</span><span style="color: #cc66cc;">1</span> <span style="color: #000066;">-eq</span> <span style="color: #660033; font-weight: bold;">$board</span>.<span style="color: #003366;">Count</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span> <span style="color: #666699; font-weight: bold;">return</span> <span style="color: #660033; font-weight: bold;">$true</span> <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp;<br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># place the queen in the next row</span><br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># try every column .... </span><br />
&nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">for</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$c</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">0</span>;<span style="color: #660033; font-weight: bold;">$c</span> <span style="color: #000066;">-lt</span> <span style="color: #660033; font-weight: bold;">$board</span>.<span style="color: #003366;">Count</span>; <span style="color: #660033; font-weight: bold;">$c</span><span style="color: #66cc66;">++</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$clean</span> <span style="color: #66cc66;">=</span> <span style="color: #660033; font-weight: bold;">$true</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># check it against every prior row</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">for</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$r</span><span style="color: #66cc66;">=</span><span style="color: #cc66cc;">0</span>; <span style="color: #660033; font-weight: bold;">$r</span> <span style="color: #000066;">-le</span> <span style="color: #660033; font-weight: bold;">$row</span>; <span style="color: #660033; font-weight: bold;">$r</span><span style="color: #66cc66;">++</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #660033; font-weight: bold;">$clean</span> <span style="color: #66cc66;">=</span> <span style="color: #660033; font-weight: bold;">$clean</span> <span style="color: #000066;">-and</span> <span style="color: #333;">&#40;</span>Check<span style="color: #66cc66;">-</span>Queen <span style="color: #660033; font-weight: bold;">$r</span> <span style="color: #660033; font-weight: bold;">$board</span><span style="color: #333;">&#91;</span><span style="color: #660033; font-weight: bold;">$r</span><span style="color: #333;">&#93;</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$row</span><span style="color: #66cc66;">+</span><span style="color: #cc66cc;">1</span><span style="color: #333;">&#41;</span> <span style="color: #660033; font-weight: bold;">$c</span><span style="color: #333;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #66cc66;">!</span><span style="color: #660033; font-weight: bold;">$clean</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span> <span style="color: #666699; font-weight: bold;">break</span>; <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># if we found the spot, recurse the next row...</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$clean</span> <span style="color: #000066;">-and</span><span style="color: #333;">&#40;</span> <span style="color: #0066cc; font-style: italic;">Set-<span style="font-style: normal;">Queen</span></span> <span style="color: #660033; font-weight: bold;">$board</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$row</span><span style="color: #66cc66;">+</span><span style="color: #cc66cc;">1</span><span style="color: #333;">&#41;</span> <span style="color: #660033; font-weight: bold;">$c</span> <span style="color: #333;">&#41;</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">return</span> <span style="color: #660033; font-weight: bold;">$true</span>;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #333;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #666699; font-weight: bold;">return</span> <span style="color: #660033; font-weight: bold;">$false</span><br />
<span style="color: #333;">&#125;</span><br />
<br />
<span style="color: #660033; font-weight: bold;">$board</span> <span style="color: #66cc66;">=</span> <span style="color: #0066cc; font-style: italic;">new-<span style="font-style: normal;">object</span></span> <span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#91;</span><span style="color: #333;">&#93;</span> <span style="color: #660033; font-weight: bold;">$size</span><br />
<br />
<span style="color: #666666; font-style: italic;"># if starting in 0,0 doesn't work 0,1 will</span><br />
<span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #0066cc; font-style: italic;">Set-<span style="font-style: normal;">Queen</span></span> <span style="color: #660033; font-weight: bold;">$board</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #0066cc; font-style: italic;">Out-<span style="font-style: normal;">Board</span></span> <span style="color: #660033; font-weight: bold;">$board</span><br />
<span style="color: #333;">&#125;</span><span style="color: #666699; font-weight: bold;">elseif</span><span style="color: #333;">&#40;</span><span style="color: #0066cc; font-style: italic;">Set-<span style="font-style: normal;">Queen</span></span> <span style="color: #660033; font-weight: bold;">$board</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">1</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #0066cc; font-style: italic;">Out-<span style="font-style: normal;">Board</span></span> <span style="color: #660033; font-weight: bold;">$board</span><br />
<span style="color: #333;">&#125;</span></div>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/eight-queens-in-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Recursion in PowerShell &#8230; slow</title>
		<link>http://huddledmasses.org/recursion-in-powershell-slow/</link>
		<comments>http://huddledmasses.org/recursion-in-powershell-slow/#comments</comments>
		<pubDate>Mon, 04 Feb 2008 06:12:20 +0000</pubDate>
		<dc:creator>Joel 'Jaykul' Bennett</dc:creator>
				<category><![CDATA[Huddled]]></category>
		<category><![CDATA[Fibonacci]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[PowerShell]]></category>
		<category><![CDATA[Recursion]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Timing]]></category>

		<guid isPermaLink="false">http://HuddledMasses.org/recursion-in-powershell-slow/</guid>
		<description><![CDATA[So, I posted a story about Fibonacci sequences and noticed that the recursion in PowerShell is really rather slow. But I also noticed something interesting &#8212; I had expected that recursing using a function would be a little cheaper (and faster) than recursing using the pipeline, and it turns out that it&#8217;s not. At all. [...]]]></description>
			<content:encoded><![CDATA[	<p>So, I posted <a href="http://huddledmasses.org/fibbonaci-sequence-in-powershell/">a story about Fibonacci sequences</a> and noticed that the recursion in PowerShell is really rather slow. But I also noticed something interesting &#8212; I had expected that recursing using a function would be a little cheaper (and faster) than recursing using the pipeline, and it turns out that it&#8217;s not. At all.  </p>

	<p>I&#8217;d love to hear some thoughts on why I got the speed results I got here.  At first I thought it was something about type coercion, but as you can see, I tried casting everything to no avail.  There&#8217;s no difference if I don&#8217;t output anything, and in fact, the non-recursive algorithm can trivially output every Fibonacci number in the sequence without affecting it&#8217;s time (I actually altered it so it didn&#8217;t to keep the output clean).</p>

	<p>Obviously I expected the recursive algorithms to be slow and scale badly because of the amount of work involved, but how is it that the pipeline-recursive &#8220;filter&#8221; outperforms the plain old recursive function (albeit by an infinitesimal fraction)?</p>

	<div class="posh code posh" style="font-family:monospace;"><br />
<span style="color: #333;">&#91;</span>08<span style="color: #333;">&#93;</span>: <span style="color: #666699; font-weight: bold;">function</span> fibfunction<span style="color: #333;">&#40;</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$i</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#123;</span> <span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$i</span> <span style="color: #000066;">-lt</span> <span style="color: #cc66cc;">2</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#123;</span> <span style="color: #cc66cc;">1</span> <span style="color: #333;">&#125;</span><span style="color: #666699; font-weight: bold;">else</span><span style="color: #333;">&#123;</span> <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #333;">&#40;</span>fibfunction <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$i</span><span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#41;</span> <span style="color: #66cc66;">+</span> <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #333;">&#40;</span>fibfunction <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$i</span><span style="color: #66cc66;">-</span><span style="color: #cc66cc;">2</span><span style="color: #333;">&#41;</span><span style="color: #333;">&#41;</span> <span style="color: #333;">&#125;</span> <span style="color: #333;">&#125;</span><br />
<br />
<span style="color: #333;">&#91;</span>09<span style="color: #333;">&#93;</span>: <span style="color: #666699; font-weight: bold;">filter</span> fibfilter<span style="color: #333;">&#123;</span> <span style="color: #666699; font-weight: bold;">if</span><span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$_</span><span style="color: #66cc66;">-</span>lt2<span style="color: #333;">&#41;</span><span style="color: #333;">&#123;</span><span style="color: #cc66cc;">1</span><span style="color: #333;">&#125;</span><span style="color: #666699; font-weight: bold;">else</span><span style="color: #333;">&#123;</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #333;">&#40;</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$_</span><span style="color: #66cc66;">-</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">|</span>fibfilter<span style="color: #333;">&#41;</span><span style="color: #66cc66;">+</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #333;">&#40;</span><span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$_</span><span style="color: #66cc66;">-</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">|</span>fibfilter<span style="color: #333;">&#41;</span><span style="color: #333;">&#125;</span><span style="color: #333;">&#125;</span><br />
<br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">10</span><span style="color: #333;">&#93;</span>: <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$size</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">18</span><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">11</span><span style="color: #333;">&#93;</span>: fibfunction <span style="color: #660033; font-weight: bold;">$size</span><br />
<span style="color: #cc66cc;">4181</span><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">12</span><span style="color: #333;">&#93;</span>: <span style="color: #660033; font-weight: bold;">$size</span> <span style="color: #66cc66;">|</span> fibfilter<br />
<span style="color: #cc66cc;">4181</span><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">13</span><span style="color: #333;">&#93;</span>: <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$a</span>,<span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$b</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">1</span>; 0..<span style="color: #660033; font-weight: bold;">$size</span><span style="color: #66cc66;">|%</span><span style="color: #333;">&#123;</span><span style="color: #660033; font-weight: bold;">$a</span>,<span style="color: #660033; font-weight: bold;">$b</span> <span style="color: #66cc66;">=</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$a</span><span style="color: #66cc66;">+</span><span style="color: #660033; font-weight: bold;">$b</span><span style="color: #333;">&#41;</span>,<span style="color: #660033; font-weight: bold;">$a</span><span style="color: #333;">&#125;</span>; <span style="color: #660033; font-weight: bold;">$a</span><br />
<span style="color: #cc66cc;">4181</span><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">14</span><span style="color: #333;">&#93;</span>: <span style="color: #0066cc; font-style: italic;">get-<span style="font-style: normal;">history</span></span> <span style="color: #000066;">-count</span> <span style="color: #cc66cc;">3</span> <span style="color: #66cc66;">|</span> <span style="color: #660033;">fl</span> CommandLine,@<span style="color: #333;">&#123;</span>l<span style="color: #66cc66;">=</span><span style="color: #009900;">&quot;Duration&quot;</span>; e<span style="color: #66cc66;">=</span><span style="color: #333;">&#123;</span><span style="color: #660033; font-weight: bold;">$_</span>.<span style="color: #003366;">EndExecutionTime</span> <span style="color: #66cc66;">-</span> <span style="color: #660033; font-weight: bold;">$_</span>.<span style="color: #003366;">StartExecutionTime</span><span style="color: #333;">&#125;</span><span style="color: #333;">&#125;</span><br />
<br />
CommandLine : fibfunction <span style="color: #660033; font-weight: bold;">$size</span><br />
Duration &nbsp; &nbsp;: 00:00:<span style="color: #cc66cc;">02.4764040</span><br />
<br />
CommandLine : <span style="color: #660033; font-weight: bold;">$size</span> <span style="color: #66cc66;">|</span> fibfilter<br />
Duration &nbsp; &nbsp;: 00:00:<span style="color: #cc66cc;">02.2137255</span><br />
<br />
CommandLine : <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$a</span>,<span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$b</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">1</span>; 0..<span style="color: #660033; font-weight: bold;">$size</span><span style="color: #66cc66;">|%</span><span style="color: #333;">&#123;</span><span style="color: #660033; font-weight: bold;">$a</span>,<span style="color: #660033; font-weight: bold;">$b</span> <span style="color: #66cc66;">=</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$a</span><span style="color: #66cc66;">+</span><span style="color: #660033; font-weight: bold;">$b</span><span style="color: #333;">&#41;</span>,<span style="color: #660033; font-weight: bold;">$a</span><span style="color: #333;">&#125;</span>; <span style="color: #660033; font-weight: bold;">$a</span><br />
Duration &nbsp; &nbsp;: 00:00:<span style="color: #cc66cc;">00.0048825</span><br />
<br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">15</span><span style="color: #333;">&#93;</span>: <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$size</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">21</span><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">16</span><span style="color: #333;">&#93;</span>: fibfunction <span style="color: #660033; font-weight: bold;">$size</span><br />
<span style="color: #cc66cc;">17711</span><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">17</span><span style="color: #333;">&#93;</span>: <span style="color: #660033; font-weight: bold;">$size</span> <span style="color: #66cc66;">|</span> fibfilter<br />
<span style="color: #cc66cc;">17711</span><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">18</span><span style="color: #333;">&#93;</span>: <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$a</span>,<span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$b</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">1</span>; 0..<span style="color: #660033; font-weight: bold;">$size</span><span style="color: #66cc66;">|%</span><span style="color: #333;">&#123;</span><span style="color: #660033; font-weight: bold;">$a</span>,<span style="color: #660033; font-weight: bold;">$b</span> <span style="color: #66cc66;">=</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$a</span><span style="color: #66cc66;">+</span><span style="color: #660033; font-weight: bold;">$b</span><span style="color: #333;">&#41;</span>,<span style="color: #660033; font-weight: bold;">$a</span><span style="color: #333;">&#125;</span>; <span style="color: #660033; font-weight: bold;">$a</span><br />
<span style="color: #cc66cc;">17711</span><br />
<span style="color: #333;">&#91;</span><span style="color: #cc66cc;">19</span><span style="color: #333;">&#93;</span>: <span style="color: #0066cc; font-style: italic;">get-<span style="font-style: normal;">history</span></span> <span style="color: #000066;">-count</span> <span style="color: #cc66cc;">3</span> <span style="color: #66cc66;">|</span> <span style="color: #660033;">fl</span> CommandLine,@<span style="color: #333;">&#123;</span>l<span style="color: #66cc66;">=</span><span style="color: #009900;">&quot;Duration&quot;</span>; e<span style="color: #66cc66;">=</span><span style="color: #333;">&#123;</span><span style="color: #660033; font-weight: bold;">$_</span>.<span style="color: #003366;">EndExecutionTime</span> <span style="color: #66cc66;">-</span> <span style="color: #660033; font-weight: bold;">$_</span>.<span style="color: #003366;">StartExecutionTime</span><span style="color: #333;">&#125;</span><span style="color: #333;">&#125;</span><br />
<br />
CommandLine : <span style="color: #660033; font-weight: bold;">$null</span> <span style="color: #66cc66;">=</span> fibfunction <span style="color: #660033; font-weight: bold;">$size</span><br />
Duration &nbsp; &nbsp;: 00:00:<span style="color: #cc66cc;">10.5764715</span><br />
<br />
CommandLine : <span style="color: #660033; font-weight: bold;">$null</span> <span style="color: #66cc66;">=</span> <span style="color: #660033; font-weight: bold;">$size</span> <span style="color: #66cc66;">|</span> fibfilter<br />
Duration &nbsp; &nbsp;: 00:00:<span style="color: #cc66cc;">09.6282900</span><br />
<br />
CommandLine : <span style="color: #660033; font-weight: bold;">$null</span> <span style="color: #66cc66;">=</span> <span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$a</span>,<span style="color: #003366; font-weight: bold;"><span style="color: #333;">&#91;</span><span style="color: #003366; font-weight: bold;">int</span><span style="color: #333;">&#93;</span></span><span style="color: #660033; font-weight: bold;">$b</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">0</span>,<span style="color: #cc66cc;">1</span>; 0..<span style="color: #660033; font-weight: bold;">$size</span><span style="color: #66cc66;">|%</span><span style="color: #333;">&#123;</span><span style="color: #660033; font-weight: bold;">$a</span>,<span style="color: #660033; font-weight: bold;">$b</span> <span style="color: #66cc66;">=</span> <span style="color: #333;">&#40;</span><span style="color: #660033; font-weight: bold;">$a</span><span style="color: #66cc66;">+</span><span style="color: #660033; font-weight: bold;">$b</span><span style="color: #333;">&#41;</span>,<span style="color: #660033; font-weight: bold;">$a</span><span style="color: #333;">&#125;</span>; <span style="color: #660033; font-weight: bold;">$a</span><br />
Duration &nbsp; &nbsp;: 00:00:<span style="color: #cc66cc;">00.0058590</span></div>

	<p>P.S.: The numbers in braces with the colon (like [18]: ... ) is my prompt.</p>]]></content:encoded>
			<wfw:commentRss>http://huddledmasses.org/recursion-in-powershell-slow/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

