Skip to content

Commit 4cc28b4

Browse files
authored
Merge pull request #10 from stefan-hoeck/gc
[ gc ] collect garbage before timing a computations
2 parents 2f7982c + e2cf53a commit 4cc28b4

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/Profile/Runner.idr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import Profile.Types
88

99
%default total
1010

11+
%foreign "scheme,chez:(lambda () (collect (collect-maximum-generation)))"
12+
"javascript:lambda:(w) => {}"
13+
prim__collect : PrimIO ()
14+
1115
unitFor : Integer -> String
1216
unitFor 0 = "fs"
1317
unitFor 1 = "ps"
@@ -57,10 +61,11 @@ runs = go 600 [< 1] 1 1.0
5761
in go k (if p2.val > p.val then sx :< p2 else sx) p2 nx
5862

5963
-- runs a benchmark once with the given number of
60-
-- interations
64+
-- iterations
6165
run : Pos -> Benchmarkable err -> IO (Either err Measured)
6266
run p (MkBenchmarkable alloc clean go cpuonly) = do
6367
env <- alloc p
68+
fromPrim prim__collect
6469
start <- clockTime Monotonic
6570
startCPU <- clockTime Process
6671
res <- go env p

0 commit comments

Comments
 (0)