on request_timeout help sign in
27 lines 1.0 kB history raw
1import Criterion.Main
2import ProjectM36.Relation
3import ProjectM36.Base
4import ProjectM36.Error
5import qualified ProjectM36.Attribute as A
6import qualified Data.Text as T
7import qualified Data.Vector as V
9-- returns a relation with tupleCount tuples with a set of integer attributes attributesCount long
10-- this is useful for performance and resource usage testing
11matrixRelation :: Int -> Int -> Either RelationalError Relation
12matrixRelation attributeCount tupleCount = do
13 let attrs = A.attributesFromList $ map (\c-> Attribute (T.pack $ "a" ++ show c) IntAtomType) [0 .. attributeCount-1]
14 tuple tupleX = RelationTuple attrs (V.generate attributeCount (\_ -> IntAtom tupleX))
15 tuples = map (\c -> tuple c) [0 .. tupleCount]
16 mkRelationDeferVerify attrs (RelationTupleSet tuples)
18main :: IO ()
19main = defaultMain [
20 bgroup "Big Relation" [
21 bench "100" $ whnf (matrixRelation 10) 100,
22 bench "1000" $ whnf (matrixRelation 10) 1000,
23 bench "10000" $ whnf (matrixRelation 10) 10000
24 ]
25 ]