urbit-hob

Haskell utilities for phonemic base wrangling.
git clone git://git.jtobin.io/urbit-hob.git
Log | Files | Refs | README | LICENSE

Ob.hs (2123B)


      1 {-# LANGUAGE OverloadedStrings #-}
      2 
      3 module Main where
      4 
      5 import Control.DeepSeq
      6 import Criterion.Main
      7 import qualified Urbit.Ob as Ob
      8 
      9 instance NFData Ob.Patp
     10 
     11 patpGroup :: Benchmark
     12 patpGroup = bgroup "patp" [
     13     bench "~zod" $
     14       nf Ob.patp 0x0000
     15 
     16   , bench "~marzod" $
     17       nf Ob.patp 0x0100
     18 
     19   , bench "~dapnep-ronmyl" $
     20       nf Ob.patp 0x00010000
     21 
     22   , bench "~fipfes-fipfes-dostec-risfen" $
     23       nf Ob.patp 0xFFFFFFFFFFFFFFFF
     24 
     25   , bench "~fipfes-fipfes-fipfes-fipfes--fipfes-fipfes-fipfes-fipfes" $
     26       nf Ob.patp 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
     27   ]
     28 
     29 fromPatpGroup :: Benchmark
     30 fromPatpGroup = bgroup "fromPatp" [
     31    bench "~zod" $
     32      whnf Ob.fromPatp (Ob.patp 0x0000)
     33 
     34  , bench "~marzod" $
     35      whnf Ob.fromPatp (Ob.patp 0x0100)
     36 
     37  , bench "~dapnep-ronmyl" $
     38      whnf Ob.fromPatp (Ob.patp 0x00010000)
     39 
     40  , bench "~fipfes-fipfes-dostec-risfen" $
     41      whnf Ob.fromPatp (Ob.patp 0xFFFFFFFFFFFFFFFF)
     42 
     43  , bench "~fipfes-fipfes-fipfes-fipfes--fipfes-fipfes-fipfes-fipfes" $
     44      whnf Ob.fromPatp (Ob.patp 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
     45  ]
     46 
     47 renderGroup :: Benchmark
     48 renderGroup = bgroup "renderPatp" [
     49    bench "~zod" $
     50      nf Ob.renderPatp (Ob.patp 0x0000)
     51 
     52  , bench "~marzod" $
     53      nf Ob.renderPatp (Ob.patp 0x0100)
     54 
     55  , bench "~dapnep-ronmyl" $
     56      nf Ob.renderPatp (Ob.patp 0x00010000)
     57 
     58  , bench "~fipfes-fipfes-dostec-risfen" $
     59      nf Ob.renderPatp (Ob.patp 0xFFFFFFFFFFFFFFFF)
     60 
     61  , bench "~fipfes-fipfes-fipfes-fipfes--fipfes-fipfes-fipfes-fipfes" $
     62      nf Ob.renderPatp (Ob.patp 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
     63  ]
     64 
     65 parseGroup :: Benchmark
     66 parseGroup = bgroup "parsePatp" [
     67    bench "~zod" $
     68      nf Ob.parsePatp "~zod"
     69 
     70  , bench "~marzod" $
     71      nf Ob.parsePatp "~marzod"
     72 
     73  , bench "~dapnep-ronmyl" $
     74      nf Ob.parsePatp "~dapnep-ronmyl"
     75 
     76  , bench "~fipfes-fipfes-dostec-risfen" $
     77      nf Ob.parsePatp "~fipfes-fipfes-dostec-risfen"
     78 
     79  , bench "~fipfes-fipfes-fipfes-fipfes--fipfes-fipfes-fipfes-fipfes" $
     80      nf Ob.parsePatp "~fipfes-fipfes-fipfes-fipfes--fipfes-fipfes-fipfes-fipfes"
     81  ]
     82 
     83 main :: IO ()
     84 main = defaultMain [
     85     patpGroup
     86   , fromPatpGroup
     87   , renderGroup
     88   , parseGroup
     89   ]