Performance tweaks
This commit is contained in:
+14
-5
@@ -3,6 +3,7 @@ import Criterion.Main
|
||||
import Dodge.RandomHelp
|
||||
|
||||
import Geometry
|
||||
import Dodge.Creature.Inanimate
|
||||
|
||||
import System.Random
|
||||
import Control.Monad (replicateM)
|
||||
@@ -12,12 +13,20 @@ import Data.List (zip4)
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
[ps1, ps2, ps3, ps4] <- mapM randomPoints [500,500,500,500]
|
||||
fs <- replicateM 500 (randomRIO (1,20))
|
||||
[ps1, ps2, ps3, ps4] <- mapM randomPoints [5,10,50,500]
|
||||
-- fs <- replicateM 500 (randomRIO (1,20))
|
||||
defaultMain
|
||||
[ bgroup "circLine tests"
|
||||
[ bench "circLine" $ nf (map $ uncurry4 circOnLine) (zip4 ps1 ps2 ps3 fs)
|
||||
, bench "circLine'" $ nf (map $ uncurry4 circOnLine') (zip4 ps1 ps2 ps3 fs)
|
||||
[ bgroup "polyToTris tests"
|
||||
[ bench "polyToTris 5" $ nf polyToTris ps1
|
||||
, bench "polyToTris 10" $ nf polyToTris ps2
|
||||
, bench "polyToTris 50" $ nf polyToTris ps3
|
||||
, bench "polyToTris 500" $ nf polyToTris ps4
|
||||
]
|
||||
, bgroup "polyToTriFold tests"
|
||||
[ bench "polyToTriFold 5" $ nf polyToTris'' ps1
|
||||
, bench "polyToTriFold 10" $ nf polyToTris'' ps2
|
||||
, bench "polyToTriFold 50" $ nf polyToTris'' ps3
|
||||
, bench "polyToTriFold 500" $ nf polyToTris'' ps4
|
||||
]
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user