<div dir="ltr"><div class="" itemprop="text">

<p>I am trying to efficiently use multicores for my <a href="https://github.com/mlitchard/swiftfizz" rel="nofollow">fizzbuzz</a>
 project. My fizzbuzz uses a Fibonacci generator as input, and this is 
where it can get computationally heavy. I believe I have picked the best
 algorithm for my project (please correct this if wrong), and now I am 
trying to use <a href="https://hackage.haskell.org/package/parallel-3.2.1.0" rel="nofollow">the parallel package</a>.
 I am not getting any better performance in the sense that if I try to 
compute the 100th Fibonacci number, it is still computing , using 4 
cores, several minutes later.</p>

<p>Here is my attempt. Please show me how to use this library right.</p>

<p>from <code>src/FizzBuzz.hs</code></p>

<pre style="" class=""><code><span class="">fizzBuzzFib </span><span class="">::</span><span class=""> Integer </span><span class="">-></span><span class=""> </span><span class="">[</span><span class="">Text</span><span class="">]</span><span class="">
fizzBuzzFib ub </span><span class="">=</span><span class=""> parMap rdeepseq fizzbuzz </span><span class="">$!</span><span class=""> fibSeq ub</span></code></pre>

<p>from <code>src/FizzFub.hs</code></p>

<pre style="" class=""><code><span class="">fibSeq </span><span class="">::</span><span class=""> Integer </span><span class="">-></span><span class=""> </span><span class="">[</span><span class="">Integer</span><span class="">]</span><span class="">
fibSeq ub </span><span class="">=</span><span class="">
withStrategy </span><span class="">(</span><span class="">parBuffer buffer rdeepseq</span><span class="">)</span><span class=""> </span><span class="">$</span><span class=""> genericTake ub fibb
</span><span class="">where</span><span class="">
  buffer </span><span class="">=</span><span class=""> </span><span class="">100<br><br></span></code><span class="">fibb</span> :: [<span class="">Integer</span>]    
fibb <span class="">=</span> <span class="">0</span> <span class="">:</span> <span class="">1</span> <span class="">:</span> <span class="">zipWith</span> <span class="">(+)</span> fibb (<span class="">tail</span> fibb) <br></pre>
    </div></div>