Permalink
Browse files

Build Haskell benchmarks with cabal

  • Loading branch information...
1 parent 38e1482 commit 6810039818e78927ebd2aa347f827ccd348f1f77 @bos committed Dec 22, 2011
View
@@ -1,6 +1,6 @@
.*\.(?:aux|h[ip]|o|orig|out|pdf|prof|ps|rej)$
^(?:dist|\.DS_Store)$
-^benchmarks/(?:AesonParse|AesonEncode|JsonParse|.*_p)$
+^benchmarks/dist$
^tests/(?:qc)
syntax: glob
View
@@ -84,6 +84,7 @@ description:
extra-source-files:
README.markdown
+ benchmarks/*.cabal
benchmarks/*.hs
benchmarks/*.py
benchmarks/Makefile
@@ -3,8 +3,6 @@
import Control.Exception
import Control.Monad
import Data.Aeson
-import Data.Aeson.Encode
-import Data.Aeson.Parser
import Data.Attoparsec
import Data.Time.Clock
import System.Environment (getArgs)
View
@@ -1,10 +1,8 @@
{-# LANGUAGE BangPatterns, OverloadedStrings #-}
-import Control.DeepSeq
import Control.Exception
import Control.Monad
import Data.Aeson
-import Data.Aeson.Parser
import Data.Attoparsec
import Data.Time.Clock
import System.Environment (getArgs)
@@ -36,15 +36,15 @@ decodeA s = case A.decode' s of
Just v -> v
jsonData :: FilePath
-jsonData = "benchmarks/json-data/jp100.json"
+jsonData = "json-data/jp100.json"
main :: IO ()
main = do
js <- readFile jsonData
as <- BL.readFile jsonData
let jdata = decodeJ js
adata = decodeA as
- (jdata, adata) `deepseq` defaultMain [
+ defaultMain [
bgroup "decode" [ bench "json" $ nf decodeJ js
, bench "aeson" $ nf decodeA as
],
View
@@ -1,13 +1,12 @@
{-# LANGUAGE BangPatterns, ScopedTypeVariables #-}
+{-# OPTIONS_GHC -fno-warn-orphans #-}
import Control.DeepSeq
-import Control.Exception
import Control.Monad
import Text.JSON
import Data.Time.Clock
import System.Environment (getArgs)
import System.IO
-import qualified Data.ByteString as B
instance NFData JSValue where
rnf JSNull = ()
@@ -0,0 +1,39 @@
+name: aeson-benchmarks
+version: 0
+build-type: Simple
+
+cabal-version: >=1.2
+
+executable aeson-benchmark-compare-with-json
+ main-is: CompareWithJSON.hs
+ ghc-options: -Wall -O2
+ build-depends:
+ aeson == 0.4.0.0,
+ base,
+ bytestring,
+ criterion,
+ json
+
+executable aeson-benchmark-aeson-encode
+ main-is: AesonEncode.hs
+ ghc-options: -Wall -O2
+ build-depends:
+ aeson == 0.4.0.0,
+ base
+
+executable aeson-benchmark-aeson-parse
+ main-is: AesonParse.hs
+ ghc-options: -Wall -O2
+ build-depends:
+ aeson == 0.4.0.0,
+ attoparsec,
+ base
+
+executable aeson-benchmark-json-parse
+ main-is: JsonParse.hs
+ ghc-options: -Wall -O2
+ build-depends:
+ base,
+ deepseq,
+ json,
+ time

0 comments on commit 6810039

Please sign in to comment.