Skip to content

Instantly share code, notes, and snippets.

@wereHamster
Created May 17, 2014 11:26
Show Gist options
  • Save wereHamster/c399743135c332cc711c to your computer and use it in GitHub Desktop.
Save wereHamster/c399743135c332cc711c to your computer and use it in GitHub Desktop.
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Monad
import Data.Text (Text)
import Data.Aeson.Types (Value)
import qualified Database.RethinkDB as R
import Criterion.Main
createRethinkHandle :: IO R.RethinkDBHandle
createRethinkHandle = do
handle <- R.connect "localhost" 28015 Nothing
return $ R.use handle (R.db "test")
rawLookup :: R.RethinkDBHandle -> IO ()
rawLookup handle = do
void (R.run handle $ R.get key table :: IO (Maybe Value))
where
table = R.table "snapshots"
key = R.expr ("0ovUatO5oD@5" :: Text)
main :: IO ()
main = do
handle <- createRethinkHandle
defaultMain [ bench "lookup" $ nfIO $ rawLookup handle ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment