Skip to content

Instantly share code, notes, and snippets.

michaelt michaelt

Block or report user

Report or block michaelt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View bench_foundation.hs
module Main where
import qualified Foundation as F
import qualified Foundation.Collection as F
import qualified Foundation.String as F
import qualified Foundation.Compat.ByteString as F
import Criterion.Main
import qualified Data.Text as T
@michaelt
michaelt / Text.hs
Created Aug 13, 2016
bench Foundation compared to Text
View Text.hs
module Main where
import qualified Foundation as F
import qualified Foundation.Collection as F
import qualified Foundation.String as F
import Criterion.Main
import qualified Data.Text as T
@michaelt
michaelt / benchcompose.hs
Last active Jun 13, 2016
benchmark prelude compositions following the pattern of john weigley's https://github.com/jwiegley/streaming-tests
View benchcompose.hs
{-#LANGUAGE BangPatterns #-}
module Main (main) where
import Data.Conduit as C
import qualified Data.Conduit.Combinators as C
import Pipes as P
import qualified Pipes.Prelude as P
import qualified Streaming.Prelude as Str
View benchmarks.hs
{-#LANGUAGE BangPatterns #-}
-- module Main (main) where
import Data.Conduit as C
import qualified Data.Conduit.Combinators as C
import Pipes as P
import qualified Pipes.Prelude as P
import qualified Streaming.Prelude as Str
View bench.txt
benchmarking fold/streaming
time 1.493 ms (1.400 ms .. 1.591 ms)
0.978 R² (0.973 R² .. 0.987 R²)
mean 1.365 ms (1.331 ms .. 1.414 ms)
std dev 131.6 μs (100.7 μs .. 169.4 μs)
variance introduced by outliers: 69% (severely inflated)
benchmarking fold/conduit
time 3.539 ms (3.431 ms .. 3.663 ms)
0.991 R² (0.985 R² .. 0.995 R²)
View criterion.txt
benchmarking fold/streaming
time 1.493 ms (1.400 ms .. 1.591 ms)
0.978 R² (0.973 R² .. 0.987 R²)
mean 1.365 ms (1.331 ms .. 1.414 ms)
std dev 131.6 μs (100.7 μs .. 169.4 μs)
variance introduced by outliers: 69% (severely inflated)
benchmarking fold/conduit
time 3.539 ms (3.431 ms .. 3.663 ms)
0.991 R² (0.985 R² .. 0.995 R²)
@michaelt
michaelt / foldIOStream.hs
Created Jun 1, 2016
io-streams + beautiful folding
View foldIOStream.hs
{-# LANGUAGE OverloadedStrings, BangPatterns #-}
import System.IO.Streams hiding (mapM_, stderr)
import qualified System.IO.Streams as Streams
import qualified System.IO as IO
import Prelude hiding (writeFile, splitAt, read)
import Control.Applicative
import Control.Monad ((>=>), liftM)
import Control.Foldl (FoldM(..), Fold(..),impurely)
View StoreStream.hs
{-#LANGUAGE LambdaCase #-}
module StoreStream where
import Data.Store
import Data.Store.Streaming
import Data.Store.Internal
import Pipes
import qualified Pipes.Prelude as P
import qualified Pipes.Safe as P
@michaelt
michaelt / inlining.hs
Created May 6, 2016
test inline/inlinable with a simple index fold
View inlining.hs
{-#LANGUAGE BangPatterns #-}
import Control.Foldl (Fold(..))
import qualified Control.Foldl as L
import qualified Data.Vector.Unboxed as V
import qualified Data.Sequence as Seq
import Control.Applicative
import Criterion.Main
import System.Environment
a >< b = fmap (,) a <*> b
@michaelt
michaelt / Lib.hs
Created Mar 14, 2016
serial-bench
View Lib.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveGeneric #-}
You can’t perform that action at this time.