Mercurial > hg > Members > toma > Jungle-haskell
changeset 21:451bf8dcdc9c
using parList
author | Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 24 Jan 2014 09:50:27 +0900 |
parents | 97d1e67aef15 |
children | 309e3474ae29 |
files | test/ParRead.hs |
diffstat | 1 files changed, 7 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/test/ParRead.hs Fri Jan 24 06:06:30 2014 +0900 +++ b/test/ParRead.hs Fri Jan 24 09:50:27 2014 +0900 @@ -18,33 +18,20 @@ node <- getRootNode jungle "test_tree" let x = testTree node 8 - putStrLn $ show $ size x + size_x = size x + putStrLn $ show $ size_x updateRootNode jungle "test_tree" x node2 <- getRootNode jungle "test_tree" t0 <- getCurrentTime printTimeSince t0 - r <- evaluate (runEval $ test node2) - print r + let result = map (func node2) [1..1000] `using` parList rseq + print (length (filter (> size_x) result)) printTimeSince t0 -test node = do - a <- rpar (func node) - b <- rpar (func node) - c <- rpar (func node) - d <- rpar (func node) - e <- rpar (func node) - f <- rpar (func node) - g <- rpar (func node) - h <- rpar (func node) - i <- rpar (func node) - j <- rpar (func node) - k <- rpar (func node) - l <- rpar (func node) - return (a,b,c,d,e,f,g,h,i,j,k,l) - -func :: Node -> Int -func node = size node +func node num = size (addc c node [1,1]) + where + c = num `mod` 5 -- ある程度の大きさの木を作れる