Skip to content
Merged
22 changes: 11 additions & 11 deletions benchmarks/ParserBench.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ module ParserBench (benchmarks) where

import Nix.Parser

import Control.Applicative
import Criterion

benchFile :: FilePath -> Benchmark
benchFile = bench <*> whnfIO . parseNixFile . ("data/" ++)
benchFile = bench <*> whnfIO . parseNixFile . ("data/" <>)

benchmarks :: Benchmark
benchmarks = bgroup
"Parser"
[ benchFile "nixpkgs-all-packages.nix"
, benchFile "nixpkgs-all-packages-pretty.nix"
, benchFile "let-comments.nix"
, benchFile "let-comments-multiline.nix"
, benchFile "let.nix"
, benchFile "simple.nix"
, benchFile "simple-pretty.nix"
]
"Parser" $
fmap benchFile
[ "nixpkgs-all-packages.nix"
, "nixpkgs-all-packages-pretty.nix"
, "let-comments.nix"
, "let-comments-multiline.nix"
, "let.nix"
, "simple.nix"
, "simple-pretty.nix"
]
4 changes: 2 additions & 2 deletions main/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,13 @@ main = do
= liftIO
. putStrLn
. Text.unpack
. principledStringIgnoreContext
. stringIgnoreContext
. toXML
<=< normalForm
| json opts
= liftIO
. Text.putStrLn
. principledStringIgnoreContext
. stringIgnoreContext
<=< nvalueToJSONNixString
| strict opts
= liftIO . print . prettyNValue <=< normalForm
Expand Down
Loading