-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a51032e
commit 5d7c2ea
Showing
7 changed files
with
148 additions
and
93 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
{-# OPTIONS_GHC -fno-warn-missing-signatures #-} | ||
--{-# OPTIONS_GHC -fno-warn-unused-top-binds #-} | ||
|
||
import AnimalClub.Genetics | ||
import System.Random | ||
import Relude | ||
|
||
import Criterion.Main | ||
import AnimalClub.Genetics | ||
|
||
import System.Random | ||
|
||
import Criterion.Main | ||
|
||
|
||
|
||
main :: IO () | ||
main = do | ||
let | ||
lns = [100, 1000, 10000] | ||
stdg <- getStdGen | ||
let | ||
(g1,g2) = split stdg | ||
dnas = map (makeRandDNA g1) lns | ||
dnas2 = map (makeRandDNA g2) lns | ||
defaultMain [ | ||
bgroup "StdGen create" $ map (\l -> bench (show l) $ nf (makeRandDNA stdg) l) lns | ||
,bgroup "StdGen breed" $ map (\(l, dna1, dna2) -> bench (show l) $ nf (breed stdg dna1) dna2) (zip3 lns dnas dnas2) | ||
,bgroup "StdGen mutate 0.1" $ map (\(l, dna) -> bench (show l) $ nf (mutate 0.1 stdg) dna) (zip lns dnas) | ||
--,bgroup "StdGen mutateOld 0.1" $ map (\(l, dna) -> bench (show l) $ nf (mutateOld 0.1 stdg) dna) (zip lns dnas) | ||
] | ||
let | ||
lns = [100, 1000, 10000] | ||
stdg <- getStdGen | ||
let | ||
(g1,g2) = split stdg | ||
dnas = map (makeRandDNA g1) lns | ||
dnas2 = map (makeRandDNA g2) lns | ||
defaultMain [ | ||
bgroup "StdGen create" $ map (\l -> bench (show l) $ nf (makeRandDNA stdg) l) lns | ||
,bgroup "StdGen breed" $ map (\(l, dna1, dna2) -> bench (show l) $ nf (breed stdg dna1) dna2) (zip3 lns dnas dnas2) | ||
,bgroup "StdGen mutate 0.1" $ map (\(l, dna) -> bench (show l) $ nf (mutate 0.1 stdg) dna) (zip lns dnas) | ||
--,bgroup "StdGen mutateOld 0.1" $ map (\(l, dna) -> bench (show l) $ nf (mutateOld 0.1 stdg) dna) (zip lns dnas) | ||
] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{-# OPTIONS_GHC -fno-warn-missing-signatures #-} | ||
--{-# OPTIONS_GHC -fno-warn-unused-top-binds #-} | ||
|
||
import Relude | ||
|
||
import AnimalClub.Animals.Examples | ||
|
||
import AnimalClub.Animals | ||
import AnimalClub.Genetics | ||
import AnimalClub.Skellygen | ||
import AnimalClub.Skellygen.Mesh | ||
|
||
import Control.DeepSeq | ||
import System.Random | ||
|
||
import Criterion.Main | ||
|
||
main :: IO () | ||
main = do | ||
let | ||
-- this is just to generate a dummy set of props | ||
goatProps = generateAnimalProperties (makeBoneIdList goatAnimalNode) $ evalGenome goatGenome original where | ||
goatDNALength = 1000 | ||
goatGenome = makeGenomeFromPropertiesSimple goatDNALength [] goatPropertyList | ||
original = makeRandDNA (mkStdGen 0) goatDNALength | ||
skelly = animalNodeToSkellyNode goatAnimalNode | ||
potatoMesh = generatePotatoMesh skelly | ||
-- force input values before testing | ||
goatAnimalNode `deepseq` skelly `deepseq` potatoMesh `deepseq` return () | ||
defaultMain [ | ||
bgroup "animalNodeToSkellyNodeWithProps" | ||
[bench "goat" $ nf (animalNodeToSkellyNodeWithProps goatProps) goatAnimalNode] | ||
, bgroup "animalNodeToSkellyNode" | ||
[bench "goat" $ nf animalNodeToSkellyNode goatAnimalNode] | ||
, bgroup "generatePotatoMesh" | ||
[bench "goat" $ nf generatePotatoMesh skelly] | ||
, bgroup "potatoMeshToObj" | ||
[bench "goat" $ nf potatoMeshToObj potatoMesh] | ||
] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
{-# LANGUAGE DeriveAnyClass #-} | ||
{-# LANGUAGE DeriveGeneric #-} | ||
|
||
{-| | ||
Module : Builder | ||
|
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