
So out of curiosity i took the definitions given in this thread, and tried to run timing-tests. Here's what I ran:
ghc -prof -auto-all -o Test Test.h Test +RTS -p and then looked in the Test.prof file.
All tests I ran from 3 to 10 times (depending on how sure I wanted to be), so the results are not entirely exact. (I copied the "average" result to the source-file as comments above every function.) As the function doing (x:_:rest) pattern-matching was the fastest I extended the idea from that to (x1:_:x2: ... x10:_:rest), but skipping from 5 to 10, where all steps showed a small increase in performance. So a question: when increasing the pattern matched, is it somekind of way of inlining the matchings, and if so, is there some way of just saying that to the compiler how many recursions you want to inline together to increase speed? Any comments? (besides -O2 ;-) -- I remembered it too late and didn't want to restart... At least for the last two functions it showed a similar difference in seconds as with no -O2) Markus Läll