Skip to content
Snippets Groups Projects
Commit 86100751 authored by BinderDavid's avatar BinderDavid
Browse files

Replace use of "Strict" typeclass by use of deepseq library

parent 063657a6
No related branches found
No related tags found
No related merge requests found
......@@ -3,4 +3,4 @@ build:
tags:
- "x86_64-linux"
script:
- "cabal build -w $GHC"
- "cabal update && cabal build -w $GHC"
......@@ -42,11 +42,12 @@ library
autogen-modules: Paths_hpc_bin
build-depends: base >= 4 && < 5,
deepseq >= 1.4.7 && < 1.5,
directory >= 1 && < 1.4,
filepath >= 1 && < 1.5,
containers >= 0.1 && < 0.7,
array >= 0.1 && < 0.6,
hpc >= 0.6.1 && < 0.7
hpc >= 0.6.2 && < 0.7
if flag(build-tool-depends)
build-tool-depends: happy:happy >= 1.20.0
......
......@@ -10,7 +10,8 @@ import Trace.Hpc.Util
import HpcFlags
import Control.Monad
import Control.DeepSeq ( force )
import Control.Monad ( foldM )
import qualified Data.Set as Set
import qualified Data.Map as Map
......@@ -125,7 +126,7 @@ map_main _ _ = hpcError map_plugin $ "to many .tix files specified"
mergeTixFile :: Flags -> (Integer -> Integer -> Integer) -> Tix -> String -> IO Tix
mergeTixFile flags fn tix file_name = do
Just new_tix <- readTix file_name
return $! strict $ mergeTix (mergeModule flags) fn tix (filterTix flags new_tix)
return $! force $ mergeTix (mergeModule flags) fn tix (filterTix flags new_tix)
-- could allow different numbering on the module info,
-- as long as the total is the same; will require normalization.
......@@ -162,36 +163,3 @@ mergeTix modComb f
fm2 = Map.fromList [ (tixModuleName tix,tix)
| tix <- t2
]
-- What I would give for a hyperstrict :-)
-- This makes things about 100 times faster.
class Strict a where
strict :: a -> a
instance Strict Integer where
strict i = i
instance Strict Int where
strict i = i
instance Strict Hash where -- should be fine, because Hash is a newtype round an Int
strict i = i
instance Strict Char where
strict i = i
instance Strict a => Strict [a] where
strict (a:as) = (((:) $! strict a) $! strict as)
strict [] = []
instance (Strict a, Strict b) => Strict (a,b) where
strict (a,b) = (((,) $! strict a) $! strict b)
instance Strict Tix where
strict (Tix t1) =
Tix $! strict t1
instance Strict TixModule where
strict (TixModule m1 p1 i1 t1) =
((((TixModule $! strict m1) $! strict p1) $! strict i1) $! strict t1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment