Browse files

Evaluate subtrees in parallel

For the first 2 levels, which results in 16 sparks
  • Loading branch information...
1 parent 1bc2246 commit bc20582311239c04dc6ecfc049befd245aed4324 @kfish committed Nov 22, 2011
Showing with 4 additions and 1 deletion.
  1. +2 −0 Graphics/TextureSynthesis.hs
  2. +2 −1 texture-synthesis.cabal
  3. BIN tools/.texture-synthesis.hs.swp
View
2 Graphics/TextureSynthesis.hs
@@ -8,6 +8,7 @@ module Graphics.TextureSynthesis (
, flattenTexture
) where
+import Control.Parallel
import Data.Map (Map)
import qualified Data.Map as Map
@@ -77,6 +78,7 @@ quadToMap :: Int -> I2 -> I2 -> QuadTree a -> Map I2 a
quadToMap _ _ _ QuadNil = Map.empty
quadToMap lim (I2 x1 y1) (I2 x2 y2) QuadTree{..}
| treeLevel >= lim = Map.empty
+ | treeLevel < 3 = nw' `par` ne' `par` sw' `par` (pseq se' result)
| otherwise = result
where
result = Map.unions [cnews, nw', ne', sw', se']
View
3 texture-synthesis.cabal
@@ -34,7 +34,8 @@ Library
Graphics.TextureSynthesis
Build-depends:
- containers >= 0.2 && < 0.5
+ containers >= 0.2 && < 0.5,
+ parallel
-- Modules not exported by this package.
-- Other-modules:
View
BIN tools/.texture-synthesis.hs.swp
Binary file not shown.

0 comments on commit bc20582

Please sign in to comment.