Skip to content

Commit

Permalink
fix lsp-types benchmark (#3079)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
pepeiborra committed Aug 15, 2022
1 parent 49373fd commit e55004a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 16 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/bench.yml
Expand Up @@ -140,24 +140,23 @@ jobs:
run: |
column -s, -t < ghcide/bench-results/unprofiled/${{ matrix.example }}/results.csv | tee ghcide/bench-results/unprofiled/${{ matrix.example }}/results.txt
- name: tar benchmarking artifacts
run: find ghcide/bench-results -name "*.csv" -or -name "*.svg" -or -name "*.html" | xargs tar -czf benchmark-artifacts.tar.gz

- name: Archive benchmarking artifacts
uses: actions/upload-artifact@v3
with:
name: bench-results-${{ runner.os }}-${{ matrix.ghc }}
path: |
ghcide/bench-results/results.*
ghcide/bench-results/**/*.csv
ghcide/bench-results/**/*.svg
ghcide/bench-results/**/*.eventlog.html
path: benchmark-artifacts.tar.gz

- name: tar benchmarking logs
run: find ghcide/bench-results -name "*.log" -or -name "*.eventlog" -or -name "*.hp" | xargs tar -czf benchmark-logs.tar.gz

- name: Archive benchmark logs
uses: actions/upload-artifact@v3
with:
name: bench-logs-${{ runner.os }}-${{ matrix.ghc }}
path: |
ghcide/bench-results/**/*.log
ghcide/bench-results/**/*.eventlog
ghcide/bench-results/**/*.hp
path: benchmark-logs.tar.gz

bench_post_job:
if: always()
Expand Down
8 changes: 4 additions & 4 deletions ghcide/bench/config.yaml
Expand Up @@ -37,14 +37,14 @@ examples:
package: lsp-types
version: 1.5.0.0
modules:
- src/Language/LSP/VFS.hs
- src/Language/LSP/Types/Lens.hs
- src/Language/LSP/Types/WatchedFiles.hs
- src/Language/LSP/Types/CallHierarchy.hs
- name: lsp-types-conservative
package: lsp-types
version: 1.5.0.0
modules:
- src/Language/LSP/VFS.hs
- src/Language/LSP/Types/Lens.hs
- src/Language/LSP/Types/WatchedFiles.hs
- src/Language/LSP/Types/CallHierarchy.hs
extra-args:
- --conservative-change-tracking
# Small-sized project with TH
Expand Down
13 changes: 10 additions & 3 deletions ghcide/bench/lib/Experiments.hs
Expand Up @@ -24,7 +24,9 @@ module Experiments
) where
import Control.Applicative.Combinators (skipManyTill)
import Control.Exception.Safe (IOException, handleAny, try)
import Control.Monad.Extra
import Control.Monad.Extra (allM, forM, forM_, unless,
void, whenJust, (&&^))
import Control.Monad.Fail (MonadFail)
import Control.Monad.IO.Class
import Data.Aeson (Value (Null), toJSON)
import Data.Either (fromRight)
Expand Down Expand Up @@ -72,8 +74,13 @@ data DocumentPositions = DocumentPositions {
doc :: !TextDocumentIdentifier
}

allWithIdentifierPos :: Monad m => (DocumentPositions -> m Bool) -> [DocumentPositions] -> m Bool
allWithIdentifierPos f docs = allM f (filter (isJust . identifierP) docs)
allWithIdentifierPos :: MonadFail m => (DocumentPositions -> m Bool) -> [DocumentPositions] -> m Bool
allWithIdentifierPos f docs = case applicableDocs of
-- fail if there are no documents to benchmark
[] -> fail "None of the example modules have identifier positions"
docs' -> allM f docs'
where
applicableDocs = filter (isJust . identifierP) docs

experiments :: [Bench]
experiments =
Expand Down

0 comments on commit e55004a

Please sign in to comment.