on master help sign in
fix warnings in bigrel
commit54e1e99d9544be4f433bc5a83d9727c11eede1db authorAgentM <agentm@themactionfaction.com> dateMon 16 Oct 2017, 23:20 (9 years ago) parent3cc6447
1 file changed+10−7
src/bin/benchmark/bigrel.hs+10−7
src/bin/benchmark/bigrel.hs+10−7
@@ -24,11 +24,12 @@ import Control.DeepSeq
2424import Data.Text hiding (map)
2525import Data.Monoid
2626
27+{-
2728dumpcsv :: Relation -> IO ()
2829dumpcsv rel = case relationAsCSV rel of
2930 Left err -> hPrint stderr err
3031 Right bsData -> BS.putStrLn bsData
31−
32+-}
3233data BigrelArgs = BigrelArgs Int Int Text
3334
3435parseAttributeCount :: Parser Int
@@ -67,34 +68,36 @@ matrixRun (BigrelArgs attributeCount tupleCount tutd) =
6768 Right context' -> TIO.putStrLn $ relationAsHTML (relationVariables context' M.! "x")
6869 Left err -> hPrint stderr err
6970
70−
71+{-
7172intmapMatrixRun :: IO ()
7273intmapMatrixRun = do
7374 let matrix = intmapMatrixRelation 100 100000
7475 print matrix
75−
76+-}
7677--compare IntMap speed and size
7778--this is about 3 times faster (9 minutes) for 10x100000 and uses 800 MB
79+{-
7880intmapMatrixRelation :: Int -> Int -> HS.HashSet (IM.IntMap Atom)
7981intmapMatrixRelation attributeCount tupleCount = HS.fromList $ map mapper [0..tupleCount]
8082 where
8183 mapper tupCount = IM.fromList $ map (\c-> (c, IntAtom (fromIntegral tupCount))) [0..attributeCount]
82−
84+-}
8385instance Hash.Hashable (IM.IntMap Atom) where
8486 hashWithSalt salt tupMap = Hash.hashWithSalt salt (show tupMap)
85−
87+{-
8688vectorMatrixRun :: IO ()
8789vectorMatrixRun = do
8890 let matrix = vectorMatrixRelation 100 100000
8991 print matrix
90−
92+-}
9193-- 20 s 90 MBs- a clear win- ideal size is 10 * 100000 * 8 bytes = 80 MB! without IntAtom wrapper
9294--with IntAtom wrapper: 1m12s 90 MB
95+{-
9396vectorMatrixRelation :: Int -> Int -> HS.HashSet (V.Vector Atom)
9497vectorMatrixRelation attributeCount tupleCount = HS.fromList $ map mapper [0..tupleCount]
9598 where
9699 mapper tupCount = V.replicate attributeCount (IntAtom (fromIntegral tupCount))
97−
100+-}
98101instance Hash.Hashable (V.Vector Atom) where
99102 hashWithSalt salt vec = Hash.hashWithSalt salt (show vec)
100103