Skip to content

Commit

Permalink
Removing WriterT and RWST benchmarks
Browse files Browse the repository at this point in the history
I'm abandoning support for keeping `WriterT` strict in favor of Patrick's
simpler implementation using `distribute`.  The real solution is to fix
`WriterT`.
  • Loading branch information
Gabriella439 committed Nov 17, 2013
1 parent 7e3d15b commit ec12094
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions benchmarks/LiftBench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import Control.DeepSeq
import Control.Monad.Identity
import qualified Control.Monad.Trans.Reader as R
import qualified Control.Monad.Trans.State.Strict as S
import qualified Control.Monad.Trans.Writer.Strict as W
import qualified Control.Monad.Trans.RWS.Strict as RWS
import Criterion.Main
import Data.Monoid
import Pipes
Expand All @@ -33,22 +31,9 @@ iter a vmax = loop 0
s_bench :: Int -> Effect (S.StateT Int Identity) Int
s_bench = iter (\n -> S.get >>= (\a -> S.put $! a + n) >> return (n + 1))

w_bench :: Int -> Effect (W.WriterT (Sum Int) Identity) Int
w_bench = iter (\n -> (W.tell $! Sum n) >> return (n + 1))

r_bench :: Int -> Effect (R.ReaderT Int Identity) Int
r_bench = iter (\n -> R.ask >>= (\a -> return $ n + a))

rwsp_bench :: Int -> Effect (RWS.RWST Int (Sum Int) Int Identity) Int
rwsp_bench = iter act
where
act n = do
x <- RWS.ask
RWS.tell (Sum n)
s <- RWS.get
RWS.put $! (s + n)
return $ n + x

-- Run before Proxy
runB :: (a -> Effect Identity r) -> a -> r
runB f a = runIdentity $ runEffect $ f a
Expand Down Expand Up @@ -80,23 +65,4 @@ liftBenchmarks vmax =
, bench "execStateP_B" . whnf (runB (execStateP 0) . s_bench)
, bench "execStateP_A" . whnf (runA (defT S.execStateT) . s_bench)
]
{-
, bgroup "WriterT" $ applyBench
[
-- Running WriterP after runEffect will space leak.
bench "runWriterP_B" . nf (runB runWriterP . w_bench)
, bench "execWriterP_B" . nf (runB execWriterP . w_bench)
]
, bgroup "RWSP" $
let defT f = (\d -> f d 1 0)
in applyBench
[
bench "runRWSP_B" . nf (runB (runRWSP 1 0) . rwsp_bench)
, bench "runRWSP_A" . nf (runA (defT RWS.runRWST) . rwsp_bench)
, bench "evalRWSP_B" . nf (runB (evalRWSP 1 0) . rwsp_bench)
, bench "evalRWSP_A" . nf (runA (defT RWS.evalRWST) . rwsp_bench)
, bench "execRWSP_B" . nf (runB (execRWSP 1 0) . rwsp_bench)
, bench "execRWSP_A" . nf (runA (defT RWS.execRWST) . rwsp_bench)
]
-}
]

0 comments on commit ec12094

Please sign in to comment.