Created
March 29, 2010 23:50
-
-
Save spockz/348570 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renderPixel :: Int -> Int -> Int -> RayMaker -> World -> Colour Int | |
-- | |
parMap rdeepseq | |
(\(i,j) -> renderPixel depth i j raymaker world) | |
[(i,j) | i <- [0..h-1], j <- [0..w-1]] | |
-- | |
$> +RTS -N2 -s -RTS ... => 100% cpu usage; | |
---- | |
map (\(i,j) -> renderPixel depth i j raymaker world) | |
[(i,j) | i <- [0..h-1], j <- [0..w-1]] | |
`using` parListChunk (w*h `div` 2) rdeepseq | |
-- | |
$> +RTS -N2 -s -RTS ... => 100-150% cpu usage but slower. | |
---- | |
data Colour a = Colour !(a, a, a) deriving (Eq, Ord, Show) | |
type Colours a = [Colour a] | |
instance NFData (Colour a) where | |
rnf (Colour (x,y,z)) = x `seq` y `seq` z `seq` () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment