Skip to content

Commit e55004a

Browse files
authored
fix lsp-types benchmark (#3079)
* fix lsp-types paths * Fail if there are no documents to benchmark * use modules with suitable positions * Fix 8.6.5 build * fix imports for 8.6.5 * Fix benchmark artifact uploads * format
1 parent 49373fd commit e55004a

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

.github/workflows/bench.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,24 +140,23 @@ jobs:
140140
run: |
141141
column -s, -t < ghcide/bench-results/unprofiled/${{ matrix.example }}/results.csv | tee ghcide/bench-results/unprofiled/${{ matrix.example }}/results.txt
142142
143+
- name: tar benchmarking artifacts
144+
run: find ghcide/bench-results -name "*.csv" -or -name "*.svg" -or -name "*.html" | xargs tar -czf benchmark-artifacts.tar.gz
145+
143146
- name: Archive benchmarking artifacts
144147
uses: actions/upload-artifact@v3
145148
with:
146149
name: bench-results-${{ runner.os }}-${{ matrix.ghc }}
147-
path: |
148-
ghcide/bench-results/results.*
149-
ghcide/bench-results/**/*.csv
150-
ghcide/bench-results/**/*.svg
151-
ghcide/bench-results/**/*.eventlog.html
150+
path: benchmark-artifacts.tar.gz
151+
152+
- name: tar benchmarking logs
153+
run: find ghcide/bench-results -name "*.log" -or -name "*.eventlog" -or -name "*.hp" | xargs tar -czf benchmark-logs.tar.gz
152154

153155
- name: Archive benchmark logs
154156
uses: actions/upload-artifact@v3
155157
with:
156158
name: bench-logs-${{ runner.os }}-${{ matrix.ghc }}
157-
path: |
158-
ghcide/bench-results/**/*.log
159-
ghcide/bench-results/**/*.eventlog
160-
ghcide/bench-results/**/*.hp
159+
path: benchmark-logs.tar.gz
161160

162161
bench_post_job:
163162
if: always()

ghcide/bench/config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ examples:
3737
package: lsp-types
3838
version: 1.5.0.0
3939
modules:
40-
- src/Language/LSP/VFS.hs
41-
- src/Language/LSP/Types/Lens.hs
40+
- src/Language/LSP/Types/WatchedFiles.hs
41+
- src/Language/LSP/Types/CallHierarchy.hs
4242
- name: lsp-types-conservative
4343
package: lsp-types
4444
version: 1.5.0.0
4545
modules:
46-
- src/Language/LSP/VFS.hs
47-
- src/Language/LSP/Types/Lens.hs
46+
- src/Language/LSP/Types/WatchedFiles.hs
47+
- src/Language/LSP/Types/CallHierarchy.hs
4848
extra-args:
4949
- --conservative-change-tracking
5050
# Small-sized project with TH

ghcide/bench/lib/Experiments.hs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ module Experiments
2424
) where
2525
import Control.Applicative.Combinators (skipManyTill)
2626
import Control.Exception.Safe (IOException, handleAny, try)
27-
import Control.Monad.Extra
27+
import Control.Monad.Extra (allM, forM, forM_, unless,
28+
void, whenJust, (&&^))
29+
import Control.Monad.Fail (MonadFail)
2830
import Control.Monad.IO.Class
2931
import Data.Aeson (Value (Null), toJSON)
3032
import Data.Either (fromRight)
@@ -72,8 +74,13 @@ data DocumentPositions = DocumentPositions {
7274
doc :: !TextDocumentIdentifier
7375
}
7476

75-
allWithIdentifierPos :: Monad m => (DocumentPositions -> m Bool) -> [DocumentPositions] -> m Bool
76-
allWithIdentifierPos f docs = allM f (filter (isJust . identifierP) docs)
77+
allWithIdentifierPos :: MonadFail m => (DocumentPositions -> m Bool) -> [DocumentPositions] -> m Bool
78+
allWithIdentifierPos f docs = case applicableDocs of
79+
-- fail if there are no documents to benchmark
80+
[] -> fail "None of the example modules have identifier positions"
81+
docs' -> allM f docs'
82+
where
83+
applicableDocs = filter (isJust . identifierP) docs
7784

7885
experiments :: [Bench]
7986
experiments =

0 commit comments

Comments
 (0)