<span style="font-family: courier new,monospace;">&gt; I would expect my (well, I</span><span style="font-family: courier new,monospace;"> didn&#39;t invent it) to work better on something that didn&#39;t have this</span><span style="font-family: courier new,monospace;"> unique structure, such as:</span><br>
&gt; test 0 = Var 0<br>&gt; test n | even n &nbsp; &nbsp;= Or &nbsp;(Var n) (test (n-1))<br>&gt;&nbsp; &nbsp; &nbsp;&nbsp; | otherwise = And (test (n-1)) (Var n)<br>
<br>
<span style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">for some reason</span> this still does not perform as well as it should o__O<br>I think function composition might somehow be the bottleneck behind this.<br>
<br></span><span style="font-family: courier new,monospace;">--with<br>plong 0 = Var 0<br>plong n | even n&nbsp;&nbsp;&nbsp; = Or&nbsp; (Var n) (plong (n-1))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | otherwise = And (plong (n-1)) (Var n)<br><br>--and n = 1000000<br><br>
sert@elite:~/workspace/Haskell-1/bin$ time ./theResult sert</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">1000001</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">real&nbsp;&nbsp;&nbsp; 0m0.692s</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">user&nbsp;&nbsp;&nbsp; 0m0.624s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">sys&nbsp;&nbsp;&nbsp;&nbsp; 0m0.040s</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"><br>sert@elite:~/workspace/Haskell-1/bin$ time ./theResult sert</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">1000001</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">real&nbsp;&nbsp;&nbsp; 0m0.696s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">user&nbsp;&nbsp;&nbsp; 0m0.644s</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">sys&nbsp;&nbsp;&nbsp;&nbsp; 0m0.036s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"><br>sert@elite:~/workspace/Haskell-1/bin$ time ./theResult sert</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">1000001</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">real&nbsp;&nbsp;&nbsp; 0m0.840s</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">user&nbsp;&nbsp;&nbsp; 0m0.744s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">sys&nbsp;&nbsp;&nbsp;&nbsp; 0m0.052s</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"><br>sert@elite:~/workspace/Haskell-1/bin$ time ./theResult bromage</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">1000001</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">real&nbsp;&nbsp;&nbsp; 0m1.561s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">user&nbsp;&nbsp;&nbsp; 0m1.360s</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">sys&nbsp;&nbsp;&nbsp;&nbsp; 0m0.100s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"><br>sert@elite:~/workspace/Haskell-1/bin$ time ./theResult bromage</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">1000001</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">real&nbsp;&nbsp;&nbsp; 0m1.692s</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">user&nbsp;&nbsp;&nbsp; 0m1.392s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">sys&nbsp;&nbsp;&nbsp;&nbsp; 0m0.136s</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"><br>sert@elite:~/workspace/Haskell-1/bin$ time ./theResult bromage</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">1000001</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">real&nbsp;&nbsp;&nbsp; 0m1.959s</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">user&nbsp;&nbsp;&nbsp; 0m1.580s</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">sys&nbsp;&nbsp;&nbsp;&nbsp; 0m0.116s</span><br style="font-family: courier new,monospace;">
<br><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">Best Regards,<br>Cetin Sert<br></span><br><div><span class="gmail_quote">On 21/02/2008, <b class="gmail_sendername"><a href="mailto:ajb@spamcop.net">ajb@spamcop.net</a></b> &lt;<a href="mailto:ajb@spamcop.net">ajb@spamcop.net</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
G&#39;day all.<br> <br> Quoting Cetin Sert &lt;<a href="mailto:cetin.sert@gmail.com">cetin.sert@gmail.com</a>&gt;:<br> <br> <br>&gt; It is astonishing to see that your version actually performs the worst (at<br> &gt; least on my machine).<br>
 <br> <br>On your example, I&#39;m not surprised:<br> <br><br> &gt; plong 0 = Var 0<br> &gt; plong n | even n&nbsp;&nbsp;&nbsp;&nbsp;= Or&nbsp;&nbsp;(Var n) (plong (n-1))<br> &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | otherwise = And (Var n) (plong (n-1))<br> <br> <br>This is effectively a singly linked list.&nbsp;&nbsp;I would expect my (well, I<br>
 didn&#39;t invent it) to work better on something that didn&#39;t have this<br> unique structure, such as:<br> <br> test 0 = Var 0<br> test n | even n&nbsp;&nbsp;&nbsp;&nbsp;= Or&nbsp;&nbsp;(Var n) (test (n-1))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;| otherwise = And (test (n-1)) (Var n)<br>
 <br><br> Cheers,<br> Andrew Bromage<br> _______________________________________________<br> Haskell-Cafe mailing list<br> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
 </blockquote></div><br>