Permalink
Browse files

Merge pull request #82 from bgamari/master

A few new benchmarks
  • Loading branch information...
2 parents bbe8a44 + e55fc7c commit f8b7135b59653017031cc50fde315ded3ee7f85a @colah committed Dec 11, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 Benchmark.hs
View
@@ -1,5 +1,7 @@
import Criterion.Main
import Graphics.Implicit
+import Graphics.Implicit.Export.SymbolicObj2
+import Graphics.Implicit.Export.SymbolicObj3
import Graphics.Implicit.Primitives
obj2d_1 :: SymbolicObj2
@@ -27,23 +29,33 @@ object2 = squarePipe (10,10,10) 1 100
(map (\n->(n/precision)*y) [0..precision])
(map (\n->(n/precision)*z) [0..precision])
+object3 :: SymbolicObj3
+object3 =
+ difference
+ [ rect3R 1 (-1,-1,-1) (1,1,1)
+ , rect3R 1 (0,0,0) (2,2,2)
+ ]
+
obj2Benchmarks :: String -> SymbolicObj2 -> Benchmark
obj2Benchmarks name obj =
bgroup name
[ bench "SVG write" $ writeSVG 1 "benchmark.svg" obj
, bench "PNG write" $ writePNG2 1 "benchmark.png" obj
+ , bench "Get contour" $ nf (symbolicGetContour 1) obj
]
obj3Benchmarks :: String -> SymbolicObj3 -> Benchmark
obj3Benchmarks name obj =
bgroup name
[ --bench "PNG write" $ writePNG3 1 "benchmark.png" obj
bench "STL write" $ writeSTL 1 "benchmark.stl" obj
+ , bench "Get mesh" $ nf (symbolicGetMesh 1) obj
]
benchmarks =
[ obj3Benchmarks "Object 1" object1
, obj3Benchmarks "Object 2" object2
+ , obj3Benchmarks "Object 3" object3
]
main = defaultMain benchmarks

0 comments on commit f8b7135

Please sign in to comment.