on master help sign in
add simple benchmark suite
eac4071AgentM
ProjectM36/Relation.hs+10
@@ -325,5 +325,15 @@ sp :: Relation
325sp = case relvarSP of { Right r -> r }
325sp = case relvarSP of { Right r -> r }
326
326
327
327
328+-- returns a relation with tupleCount tuples with a set of integer attributes attributesCount long
329+-- this is useful for performance and resource usage testing
330+matrixRelation :: Int -> Int -> Either RelationalError Relation
331+matrixRelation attributeCount tupleCount = mkRelation attributeSet tupleSet
332+ where
333+ attributeSet = M.fromList $ map (\c-> (show c, Attribute (show c) IntAtomType)) [0 .. attributeCount]
334+ tupleSet = HS.fromList $ mkRelationTuples attributeSet $ map (\c -> tuple c) [0 .. tupleCount]
335+ tuple tupleX = M.fromList $ map (\c -> (show c, IntAtom tupleX)) [0..attributeCount]
336+
337+
328
338
329
339
benchmark/Relation.hsnew file+13
@@ -0,0 +1,13 @@
1+import Criterion.Main
2+import ProjectM36.Relation
3+
4+main :: IO ()
5+main = defaultMain [
6+ bgroup "Big Relation" [
7+ bench "100" $ whnf (matrixRelation 10) 100,
8+ bench "1000" $ whnf (matrixRelation 10) 1000,
9+ bench "10000" $ whnf (matrixRelation 10) 10000,
10+ ]
11+ ]
12+
13+