summaryrefslogtreecommitdiff
path: root/AATree/testTree.hs
diff options
context:
space:
mode:
Diffstat (limited to 'AATree/testTree.hs')
-rw-r--r--AATree/testTree.hs21
1 files changed, 14 insertions, 7 deletions
diff --git a/AATree/testTree.hs b/AATree/testTree.hs
index a9fea3f..6d625e7 100644
--- a/AATree/testTree.hs
+++ b/AATree/testTree.hs
@@ -1,10 +1,17 @@
-import AATree
-
-setup = foldl insert Nil [1..20]
+import AATree.AATree
+import Criterion.Main
+import Shuffle
+import Control.DeepSeq
+import Data.List
+import Sort.Sort
main = do
- let t = setup
- putStrLn (show $ foldr (:) [] t)
+ xs <- shuffle ([1..5000]::[Int])
+ defaultMain [
+ bench "sort" (nf sort xs),
+ bench "msort" (nf msort xs),
+ bench "aasort" (nf aasort xs),
+ bench "head-sort" (nf (head.sort) xs),
+ bench "head-msort" (nf (head.msort) xs),
+ bench "head-aasort" (nf (head.aasort) xs)]
-sort [] = []
-sort (x:xs) = sort [ i | i<-xs, i<x] ++ x:(sort [ i | i<-xs, i>=x])