Created
December 19, 2012 17:02
-
-
Save Dema/4338324 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ScopedTypeVariables #-} | |
module Main where | |
import Criterion.Main | |
import Criterion.Config | |
import qualified Data.ByteString.Lazy as B | |
import qualified Data.ByteString.Lazy.Char8 as C | |
import GHC.Word | |
bstring = B.unpack . C.pack | |
map_:: String -> [GHC.Word.Word8] | |
map_ = map (fromIntegral.fromEnum) | |
dataZ = take 100000 $ repeat 'a' | |
main = defaultMainWith defaultConfig (return ()) [ | |
bgroup "tiny" [ bench "bytestring" $ whnf bstring dataZ | |
, bench "map" $ whnf map_ dataZ | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment