> I would expect my (well, I didn't invent it) to work better on something that didn't have this unique structure, such as: > test 0 = Var 0 > test n | even n = Or (Var n) (test (n-1)) > | otherwise = And (test (n-1)) (Var n)
for some reason this still does not perform as well as it should o__O I think function composition might somehow be the bottleneck behind this. --with plong 0 = Var 0 plong n | even n = Or (Var n) (plong (n-1)) | otherwise = And (plong (n-1)) (Var n) --and n = 1000000 [EMAIL PROTECTED]:~/workspace/Haskell-1/bin$ time ./theResult sert 1000001 real 0m0.692s user 0m0.624s sys 0m0.040s [EMAIL PROTECTED]:~/workspace/Haskell-1/bin$ time ./theResult sert 1000001 real 0m0.696s user 0m0.644s sys 0m0.036s [EMAIL PROTECTED]:~/workspace/Haskell-1/bin$ time ./theResult sert 1000001 real 0m0.840s user 0m0.744s sys 0m0.052s [EMAIL PROTECTED]:~/workspace/Haskell-1/bin$ time ./theResult bromage 1000001 real 0m1.561s user 0m1.360s sys 0m0.100s [EMAIL PROTECTED]:~/workspace/Haskell-1/bin$ time ./theResult bromage 1000001 real 0m1.692s user 0m1.392s sys 0m0.136s [EMAIL PROTECTED]:~/workspace/Haskell-1/bin$ time ./theResult bromage 1000001 real 0m1.959s user 0m1.580s sys 0m0.116s Best Regards, Cetin Sert On 21/02/2008, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > G'day all. > > Quoting Cetin Sert <[EMAIL PROTECTED]>: > > > > It is astonishing to see that your version actually performs the worst > (at > > least on my machine). > > > On your example, I'm not surprised: > > > > plong 0 = Var 0 > > plong n | even n = Or (Var n) (plong (n-1)) > > | otherwise = And (Var n) (plong (n-1)) > > > This is effectively a singly linked list. I would expect my (well, I > didn't invent it) to work better on something that didn't have this > unique structure, such as: > > test 0 = Var 0 > test n | even n = Or (Var n) (test (n-1)) > | otherwise = And (test (n-1)) (Var n) > > > Cheers, > Andrew Bromage > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe >
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe