Skip to content

Commit e7a75c1

Browse files
authored
Merge pull request #1315 from haskell/bench-parallel-gc
[benchmarks] speed up CI
2 parents cc4bb62 + d48ec1d commit e7a75c1

File tree

6 files changed

+15
-21
lines changed

6 files changed

+15
-21
lines changed

.github/mergify.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ pull_request_rules:
55
method: squash
66
name: Automatically merge pull requests
77
conditions:
8-
- status-success=bench (8.10.2, ubuntu-latest)
9-
- status-success=bench (8.8.4, ubuntu-latest)
8+
- status-success=bench (8.10.3, ubuntu-latest)
109

1110
- status-success=nix (default, ubuntu-latest)
1211
- status-success=nix (default, macOS-latest)

.github/workflows/bench.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
ghc: ['8.10.2', '8.8.4']
11+
ghc: ['8.10.3']
1212
os: [ubuntu-latest]
1313

1414
steps:

ghcide/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ bench-temp/
1414
ghcide
1515
ghcide-bench
1616
ghcide-preprocessor
17-
*.benchmark-gcStats
17+
*.gcStats.log
1818
tags

ghcide/bench/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The number of samples to run per experiment.
22
# At least 100 is recommended in order to observe space leaks
3-
samples: 100
3+
samples: 50
44

55
buildTool: cabal
66

ghcide/bench/hist/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
├─ <example>
1717
│ ├── results.csv - aggregated results for all the versions
1818
│ └── <git-reference>
19-
│   ├── <experiment>.benchmark-gcStats - RTS -s output
19+
│   ├── <experiment>.gcStats.log - RTS -s output
2020
│   ├── <experiment>.csv - stats for the experiment
2121
│   ├── <experiment>.svg - Graph of bytes over elapsed time
2222
│   ├── <experiment>.diff.svg - idem, including the previous version

shake-bench/src/Development/Benchmark/Rules.hs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@
3131
├─ <example>
3232
│ ├── results.csv - aggregated results for all the versions
3333
│ └── <git-reference>
34-
│   ├── <experiment>.benchmark-gcStats - RTS -s output
34+
│   ├── <experiment>.gcStats.log - RTS -s output
3535
│   ├── <experiment>.csv - stats for the experiment
3636
│   ├── <experiment>.svg - Graph of bytes over elapsed time
3737
│   ├── <experiment>.diff.svg - idem, including the previous version
38+
│   ├── <experiment>.heap.svg - Heap profile
3839
│   ├── <experiment>.log - bench stdout
3940
│   └── results.csv - results of all the experiments for the example
4041
├── results.csv - aggregated results of all the experiments and versions
@@ -224,9 +225,9 @@ benchRules build benchResource MkBenchRules{..} = do
224225
-- run an experiment
225226
priority 0 $
226227
[ build -/- "*/*/*.csv",
227-
build -/- "*/*/*.benchmark-gcStats",
228+
build -/- "*/*/*.gcStats.log",
228229
build -/- "*/*/*.hp",
229-
build -/- "*/*/*.log"
230+
build -/- "*/*/*.output.log"
230231
]
231232
&%> \[outcsv, outGc, outHp, outLog] -> do
232233
let [_, exampleName, ver, exp] = splitDirectories outcsv
@@ -236,7 +237,7 @@ benchRules build benchResource MkBenchRules{..} = do
236237
setupRes <- setupProject
237238
liftIO $ createDirectoryIfMissing True $ dropFileName outcsv
238239
let exePath = build </> "binaries" </> ver </> executableName
239-
exeExtraArgs = ["+RTS", "-h", "-S" <> outGc, "-RTS"]
240+
exeExtraArgs = ["+RTS", "-h", "-i1", "-qg", "-S" <> outGc, "-RTS"]
240241
ghcPath = build </> "binaries" </> ver </> "ghc.path"
241242
experiment = Escaped $ dropExtension exp
242243
need [exePath, ghcPath]
@@ -250,22 +251,16 @@ benchRules build benchResource MkBenchRules{..} = do
250251
AddPath [takeDirectory ghcPath, "."] []
251252
]
252253
BenchProject {..}
253-
liftIO $ renameFile "ghcide.hp" $ dropFileName outcsv </> dropExtension exp <.> "hp"
254+
liftIO $ renameFile "ghcide.hp" outHp
254255

255256
-- extend csv output with allocation data
256257
csvContents <- liftIO $ lines <$> readFile outcsv
257258
let header = head csvContents
258259
results = tail csvContents
259260
header' = header <> ", maxResidency, allocatedBytes"
260261
results' <- forM results $ \row -> do
261-
-- assume that the gcStats file can be guessed from the row id
262-
-- assume that the row id is the first column
263-
let id = takeWhile (/= ',') row
264-
let gcStatsPath = dropFileName outcsv </> escapeSpaces id <.> "benchmark-gcStats"
265-
(maxResidency, allocations) <- liftIO $
266-
ifM (IO.doesFileExist gcStatsPath)
267-
(parseMaxResidencyAndAllocations <$> readFile gcStatsPath)
268-
(pure (0,0))
262+
(maxResidency, allocations) <- liftIO
263+
(parseMaxResidencyAndAllocations <$> readFile outGc)
269264
return $ printf "%s, %s, %s" row (showMB maxResidency) (showMB allocations)
270265
let csvContents' = header' : results'
271266
writeFileLines outcsv csvContents'
@@ -495,8 +490,8 @@ data RunLog = RunLog
495490

496491
loadRunLog :: HasCallStack => FilePath -> String -> Escaped FilePath -> FilePath -> Action RunLog
497492
loadRunLog buildF example exp ver = do
498-
let log_fp = buildF </> example </> ver </> escaped exp <.> "benchmark-gcStats"
499-
csv_fp = replaceExtension log_fp "csv"
493+
let csv_fp = buildF </> example </> ver </> escaped exp <.> "csv"
494+
log_fp = replaceExtension csv_fp "gcStats.log"
500495
log <- readFileLines log_fp
501496
csv <- readFileLines csv_fp
502497
let frames =

0 commit comments

Comments
 (0)