One of the things I liked about Haskell was the notion of pure functions and 
the fact that they can be, in theory, automatically parallelized on multicore 
hardware. I think this will become a huge deal in a few years as cores 
multiply.  My question is simply this: under GHC is this what really happens 
with, say a mapping over a pure function.  Yes, I compiled with --threaded and 
am using the +RTS -N2 options on my dual core machine.  Here's the code I wrote 
as a speed test.  It just doesn't seem any faster with -N2.  Using the ps 
command I found that multiple threads are indeed launched (this is Linux) but 
all but one show as being in a state of waiting for some event to finish (the 
ps output flags them all 'Sl'.




main = do rg <- getStdGen
          let rs = take 10000000 $ randomRs (1::Int,100000::Int) rg
              rs'= map (\n -> n*n) rs
          print rs'



      
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to