Skip to content

Commit a58768d

Browse files
committed
Add clean user-facing Fill class and remove _untypedFillN
1 parent 7b625ac commit a58768d

File tree

3 files changed

+183
-112
lines changed

3 files changed

+183
-112
lines changed

memory/Main.hs

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,39 @@
11
module Main (main) where
22

33
import qualified Bench.Compact.Pure as Compact
4+
import Bench.Compact.SExpr
45
import Test.Tasty.Bench (defaultMain)
6+
import System.Environment
7+
import Control.DeepSeq (rnf)
8+
import Control.Exception (evaluate)
59

6-
-- Launch with
10+
-- Launch regular benchmark with
711
-- stack bench linear-base:bench:memory --ba '+RTS -T'
812

13+
-- Profile parseWithoutDest with
14+
-- stack bench --library-profiling --executable-profiling --ghc-options '-fprof-late' linear-base:bench:memory --ba '+RTS -p -RTS runParseWithoutDest'
15+
16+
-- Profile parseUsingDest with
17+
-- stack bench --library-profiling --executable-profiling --ghc-options '-fprof-late' linear-base:bench:memory --ba '+RTS -p -RTS runParseUsingDest'
18+
919
-- remove useless lines in profiling results with
1020
-- .*?0\.0 0\.0 0\.0 0\.0\n
1121

22+
-- remove all lines with no individual contribution to alloc with
23+
-- .*?([0-9]+\.[0-9])\s+?0\.0\s+?([0-9]+\.[0-9])\s+([0-9]+\.[0-9])\n
24+
1225
main :: IO ()
1326
main = do
14-
defaultMain
15-
[ Compact.benchmarks
16-
]
27+
args <- getArgs
28+
case args of
29+
"runParseWithoutDest" : _ -> do
30+
sampleData <- loadSampleData
31+
let res = parseWithoutDest sampleData
32+
evaluate $ rnf $ res
33+
"runParseUsingDest" : _ -> do
34+
sampleData <- loadSampleData
35+
let res = parseUsingDest sampleData
36+
evaluate $ rnf $ res
37+
_ -> defaultMain
38+
[ Compact.benchmarks
39+
]

src/Compact/Pure.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module Compact.Pure
1212
pattern RegionContext,
1313
withRegion,
1414
Dest,
15-
fill,
15+
Fill (fill),
1616
(<|),
1717
fillComp,
1818
(<|.),

0 commit comments

Comments
 (0)