Skip to content

Commit 8a8f59b

Browse files
soulomoonfendor
andauthored
Benchmark: Enable 9.6, 9.8 (#4118)
Fix bench for newer ghc versions The following have been done: 1. No longer use the implicit-hie to generate the hie.yaml for the bench examples and in favor of using "cradle:\n cabal:\n", seems to be working with modern cabal. 2. upgrade benchmark to use 9.6, 9.8 (The latest two we support for now). 3. upgrade bench examples to `Cabal version: 3.10.2.1, lsp-types version: 2.1.1.0` 4. fix minor error that `*.hp` files duplicates its extension name --------- Co-authored-by: fendor <[email protected]>
1 parent 7610872 commit 8a8f59b

File tree

7 files changed

+32
-25
lines changed

7 files changed

+32
-25
lines changed

.github/workflows/bench.yml

+8-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,14 @@ jobs:
4646
strategy:
4747
fail-fast: false
4848
matrix:
49+
# benching the two latest GHCs we support now
50+
# since benchmark are expansive.
51+
# choosing the two latest are easier to maintain and more forward looking
52+
# see discussion https://github.com/haskell/haskell-language-server/pull/4118
53+
# also possible to add more GHCs if we performs better in the future.
4954
ghc:
50-
- '9.2'
51-
- '9.4'
55+
- '9.6'
56+
- '9.8'
5257
os:
5358
- ubuntu-latest
5459

@@ -115,7 +120,7 @@ jobs:
115120
strategy:
116121
fail-fast: false
117122
matrix:
118-
ghc: ['9.2', '9.4']
123+
ghc: ['9.6', '9.8']
119124
os: [ubuntu-latest]
120125
cabal: ['3.10']
121126
example: ['cabal', 'lsp-types']

bench/config.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ examples:
2121
# Medium-sized project without TH
2222
- name: cabal
2323
package: Cabal
24-
version: 3.6.3.0
24+
version: 3.10.2.1
2525
modules:
2626
- src/Distribution/Simple.hs
27-
- src/Distribution/Types/Module.hs
27+
- src/Distribution/Types/ComponentLocalBuildInfo.hs
2828
extra-args: [] # extra HLS command line args
2929
# Small-sized project with TH
3030
- name: lsp-types
3131
package: lsp-types
32-
version: 1.5.0.0
32+
version: 2.1.1.0
3333
modules:
34-
- src/Language/LSP/Types/WatchedFiles.hs
35-
- src/Language/LSP/Types/CallHierarchy.hs
34+
- src/Language/LSP/Protocol/Types/SemanticTokens.hs
35+
- generated/Language/LSP/Protocol/Internal/Types/NotebookDocumentChangeEvent.hs
3636

3737
- name: MultiLayerModules
3838
path: bench/MultiLayerModules.sh
@@ -129,7 +129,7 @@ versions:
129129
# WARNING: Currently bench versions later than e4234a3a5e347db249fccefb8e3fb36f89e8eafb
130130
# will be unable to send plugin configurations to earlier HLS versions. This causes
131131
# all plugins in those versions to always be enabled.
132-
# In addition bench proactively disables all plugins it knows about besides the
132+
# In addition bench proactively disables all plugins it knows about besides the
133133
# ones in the following list. However because it can only disable plugins it
134134
# knows about, any plugins that are in old versions but were removed from HLS
135135
# before the current bench will not be disabled.

ghcide-bench/ghcide-bench.cabal

-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ test-suite test
8989
default-language: GHC2021
9090
build-tool-depends:
9191
ghcide:ghcide,
92-
implicit-hie:gen-hie
9392
main-is: Main.hs
9493
hs-source-dirs: test
9594
ghc-options: -Wunused-packages

ghcide-bench/src/Experiments.hs

+17-8
Original file line numberDiff line numberDiff line change
@@ -594,15 +594,25 @@ callCommandLogging cmd = do
594594
output cmd
595595
callCommand cmd
596596

597+
simpleCabalCradleContent :: String
598+
simpleCabalCradleContent = "cradle:\n cabal:\n"
599+
600+
simpleStackCradleContent :: String
601+
simpleStackCradleContent = "cradle:\n stack:\n"
602+
603+
-- | Setup the benchmark
604+
-- we need to create a hie.yaml file for the examples
605+
-- or the hie.yaml file would be searched in the parent directories recursively
606+
-- implicit-hie is error prone for the example test `lsp-types-2.1.1.0`
607+
-- we are using the simpleCabalCradleContent for the hie.yaml file instead.
608+
-- it works if we have cabal > 3.2.
597609
setup :: HasConfig => IO SetupResult
598610
setup = do
599-
-- when alreadyExists $ removeDirectoryRecursive examplesPath
600611
benchDir <- case exampleDetails(example ?config) of
601612
ExamplePath examplePath -> do
602613
let hieYamlPath = examplePath </> "hie.yaml"
603614
alreadyExists <- doesFileExist hieYamlPath
604-
unless alreadyExists $
605-
cmd_ (Cwd examplePath) (FileStdout hieYamlPath) ("gen-hie"::String)
615+
unless alreadyExists $ writeFile hieYamlPath simpleCabalCradleContent
606616
return examplePath
607617
ExampleScript examplePath' scriptArgs -> do
608618
let exampleDir = examplesPath </> exampleName (example ?config)
@@ -613,8 +623,8 @@ setup = do
613623
cmd_ (Cwd exampleDir) examplePath scriptArgs
614624
let hieYamlPath = exampleDir </> "hie.yaml"
615625
alreadyExists <- doesFileExist hieYamlPath
616-
unless alreadyExists $
617-
cmd_ (Cwd exampleDir) (FileStdout hieYamlPath) ("gen-hie"::String)
626+
unless alreadyExists $ writeFile hieYamlPath simpleCabalCradleContent
627+
618628
return exampleDir
619629
ExampleHackage ExamplePackage{..} -> do
620630
let path = examplesPath </> package
@@ -627,7 +637,7 @@ setup = do
627637
let cabalVerbosity = "-v" ++ show (fromEnum (verbose ?config))
628638
callCommandLogging $ "cabal get " <> cabalVerbosity <> " " <> package <> " -d " <> examplesPath
629639
let hieYamlPath = path </> "hie.yaml"
630-
cmd_ (Cwd path) (FileStdout hieYamlPath) ("gen-hie"::String)
640+
writeFile hieYamlPath simpleCabalCradleContent
631641
-- Need this in case there is a parent cabal.project somewhere
632642
writeFile
633643
(path </> "cabal.project")
@@ -655,8 +665,7 @@ setup = do
655665
,"compiler"]
656666
]
657667
)
658-
659-
cmd_ (Cwd path) (FileStdout hieYamlPath) ("gen-hie"::String) ["--stack"::String]
668+
writeFile hieYamlPath simpleStackCradleContent
660669
return path
661670

662671
whenJust (shakeProfiling ?config) $ createDirectoryIfMissing True

haskell-language-server.cabal

-3
Original file line numberDiff line numberDiff line change
@@ -1848,16 +1848,13 @@ test-suite wrapper-test
18481848
benchmark benchmark
18491849
import: defaults, warnings
18501850
-- Depends on shake-bench which is unbuildable after this point
1851-
if impl(ghc >= 9.5)
1852-
buildable: False
18531851
type: exitcode-stdio-1.0
18541852
ghc-options: -threaded
18551853
main-is: Main.hs
18561854
hs-source-dirs: bench
18571855
build-tool-depends:
18581856
ghcide-bench:ghcide-bench,
18591857
hp2pretty:hp2pretty,
1860-
implicit-hie:gen-hie
18611858
default-extensions:
18621859
LambdaCase
18631860
RecordWildCards

shake-bench/shake-bench.cabal

-3
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ source-repository head
1616
location: https://github.com/haskell/haskell-language-server.git
1717

1818
library
19-
-- Depends on Chart which is unbuildable after this point
20-
if impl(ghc >= 9.5)
21-
buildable: False
2219
exposed-modules: Development.Benchmark.Rules
2320
hs-source-dirs: src
2421
build-depends:

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ benchRules build MkBenchRules{..} = do
333333
++ concat
334334
[[ "-h"
335335
, "-i" <> show i
336-
, "-po" <> outHp
336+
, "-po" <> dropExtension outHp
337337
, "-qg"]
338338
| CheapHeapProfiling i <- [prof]]
339339
++ ["-RTS"]

0 commit comments

Comments
 (0)