<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Thanks for all the advises so far.<br>
<br>
Ok, here's my monster that need to be timed in order to make a
comparison:<br>
(it's about the control digit of SEDOL numbers&nbsp;</tt> <a
 class="moz-txt-link-freetext" href="http://en.wikipedia.org/wiki/SEDOL">http://en.wikipedia.org/wiki/SEDOL</a>
):<br>
<tt><br>
<br>
knip _ [] = Nothing<br>
knip k xs = Just (splitAt k xs)<br>
<br>
ip xs = sum . zipWith (*) xs<br>
<br>
an =&nbsp; ['0'..'9']++['A'..'Z']<br>
<br>
s = take 841 $ cycle "0987654321"<br>
f = \xs -&gt; xs ++ [(sna!!).ip [1,3,1,7,3,9]. map (flip (fromJust .)
an . findIndex . (==))$xs]<br>
<br>
<br>
<br>
Here's my try for timing:<br>
<br>
*Main&gt; (foldl1 (\x y -&gt; f y) .concat.replicate 1000000 $ unfoldr
(knip 6) an)<br>
"UVWXYZ7"<br>
(1.31 secs, 330291000 bytes)<br>
<br>
(It's incl. the construction of the test list, as is in the language to
compare )<br>
<br>
I need the whole list to be evaluated.<br>
Interpreted mode IS A MUST <span class="moz-smiley-s1"><span> :-) </span></span><br>
<br>
BTW I increased stack size<br>
<br>
<br>
thanks<br>
<br>
</tt><br>
Don Stewart schreef:
<blockquote cite="mid:20080803173209.GA10149@scytale.galois.com"
 type="cite">
  <pre wrap="">bradypus:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Suppose I've:

f = map g

I want to know how much time it takes (interpreted mode) to fully 
process list xs (at least 1e6 elements) with function g. Is it 
sufficient to execute:

*Main&gt; last . f $ xs
&lt;result&gt;
(x.xx secs, yyyyyyyyyyy bytes)

Are there any hidden difficulties involved?

Reason is: comparing timings Haskell vs an interpreted language without 
laziness.

    </pre>
  </blockquote>
  <pre wrap=""><!---->
If you care about timings, it's probably a better idea to compile the
code (with optimisations on), to get a better idea of what the code
would do in a production environment.

You could then just time the binary,

    main = print . sum $ ....

    ghc -O2 A.hs --make
    time ./A

-- Don


  </pre>
</blockquote>
</body>
</html>