packages feed

thread-utils-context-0.2.0.0: bench/Bench.hs

import Criterion
import Criterion.Main
import Control.Concurrent
import Control.Concurrent.Thread.Storage 
import Control.Monad.Reader

main :: IO ()
main = do
  tsm <- newThreadStorageMap
  defaultMain
    [ bench "attach" $ whnfIO $ do
        attach tsm ()
    -- , bench "myThreadId" $ whnfIO myThreadId
    -- , bench "hashed getThreadId" $ whnfIO $ do
    --     tid <- myThreadId
    --     pure $ threadHash $ getThreadId tid
    -- , bench "local" $ whnfIO $ runReaderT (local (const ()) pure ()) ()
    ]
  -- print =<< storedItemsCount tsm