Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Benchmark: Enable 9.6, 9.8 #4118

Merged
merged 14 commits into from
Mar 7, 2024
11 changes: 8 additions & 3 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ jobs:
strategy:
fail-fast: false
matrix:
# benching the two latest GHCs we support now
# since benchmark are expansive.
# choosing the two latest are easier to maintain and more forward looking
# see discussion https:/haskell/haskell-language-server/pull/4118
# also possible to add more GHCs if we performs better in the future.
ghc:
- '9.2'
- '9.4'
- '9.6'
- '9.8'
os:
- ubuntu-latest

Expand Down Expand Up @@ -115,7 +120,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ghc: ['9.2', '9.4']
ghc: ['9.6', '9.8']
os: [ubuntu-latest]
cabal: ['3.10']
example: ['cabal', 'lsp-types']
Expand Down
12 changes: 6 additions & 6 deletions bench/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ examples:
# Medium-sized project without TH
- name: cabal
package: Cabal
version: 3.6.3.0
version: 3.10.2.1
modules:
- src/Distribution/Simple.hs
- src/Distribution/Types/Module.hs
- src/Distribution/Types/ComponentLocalBuildInfo.hs
extra-args: [] # extra HLS command line args
# Small-sized project with TH
- name: lsp-types
package: lsp-types
version: 1.5.0.0
version: 2.1.1.0
modules:
- src/Language/LSP/Types/WatchedFiles.hs
- src/Language/LSP/Types/CallHierarchy.hs
- src/Language/LSP/Protocol/Types/SemanticTokens.hs
- generated/Language/LSP/Protocol/Internal/Types/NotebookDocumentChangeEvent.hs

- name: MultiLayerModules
path: bench/MultiLayerModules.sh
Expand Down Expand Up @@ -129,7 +129,7 @@ versions:
# WARNING: Currently bench versions later than e4234a3a5e347db249fccefb8e3fb36f89e8eafb
# will be unable to send plugin configurations to earlier HLS versions. This causes
# all plugins in those versions to always be enabled.
# In addition bench proactively disables all plugins it knows about besides the
# In addition bench proactively disables all plugins it knows about besides the
# ones in the following list. However because it can only disable plugins it
# knows about, any plugins that are in old versions but were removed from HLS
# before the current bench will not be disabled.
Expand Down
1 change: 0 additions & 1 deletion ghcide-bench/ghcide-bench.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ test-suite test
default-language: GHC2021
build-tool-depends:
ghcide:ghcide,
implicit-hie:gen-hie
main-is: Main.hs
hs-source-dirs: test
ghc-options: -Wunused-packages
Expand Down
25 changes: 17 additions & 8 deletions ghcide-bench/src/Experiments.hs
Original file line number Diff line number Diff line change
Expand Up @@ -594,15 +594,25 @@ callCommandLogging cmd = do
output cmd
callCommand cmd

simpleCabalCradleContent :: String
simpleCabalCradleContent = "cradle:\n cabal:\n"

simpleStackCradleContent :: String
simpleStackCradleContent = "cradle:\n stack:\n"

-- | Setup the benchmark
-- we need to create a hie.yaml file for the examples
-- or the hie.yaml file would be searched in the parent directories recursively
-- implicit-hie is error prone for the example test `lsp-types-2.1.1.0`
-- we are using the simpleCabalCradleContent for the hie.yaml file instead.
-- it works if we have cabal > 3.2.
setup :: HasConfig => IO SetupResult
setup = do
-- when alreadyExists $ removeDirectoryRecursive examplesPath
benchDir <- case exampleDetails(example ?config) of
ExamplePath examplePath -> do
let hieYamlPath = examplePath </> "hie.yaml"
alreadyExists <- doesFileExist hieYamlPath
unless alreadyExists $
cmd_ (Cwd examplePath) (FileStdout hieYamlPath) ("gen-hie"::String)
unless alreadyExists $ writeFile hieYamlPath simpleCabalCradleContent
return examplePath
ExampleScript examplePath' scriptArgs -> do
let exampleDir = examplesPath </> exampleName (example ?config)
Expand All @@ -613,8 +623,8 @@ setup = do
cmd_ (Cwd exampleDir) examplePath scriptArgs
let hieYamlPath = exampleDir </> "hie.yaml"
alreadyExists <- doesFileExist hieYamlPath
unless alreadyExists $
cmd_ (Cwd exampleDir) (FileStdout hieYamlPath) ("gen-hie"::String)
unless alreadyExists $ writeFile hieYamlPath simpleCabalCradleContent

return exampleDir
ExampleHackage ExamplePackage{..} -> do
let path = examplesPath </> package
Expand All @@ -627,7 +637,7 @@ setup = do
let cabalVerbosity = "-v" ++ show (fromEnum (verbose ?config))
callCommandLogging $ "cabal get " <> cabalVerbosity <> " " <> package <> " -d " <> examplesPath
let hieYamlPath = path </> "hie.yaml"
cmd_ (Cwd path) (FileStdout hieYamlPath) ("gen-hie"::String)
writeFile hieYamlPath simpleCabalCradleContent
-- Need this in case there is a parent cabal.project somewhere
writeFile
(path </> "cabal.project")
Expand Down Expand Up @@ -655,8 +665,7 @@ setup = do
,"compiler"]
]
)

cmd_ (Cwd path) (FileStdout hieYamlPath) ("gen-hie"::String) ["--stack"::String]
writeFile hieYamlPath simpleStackCradleContent
return path

whenJust (shakeProfiling ?config) $ createDirectoryIfMissing True
Expand Down
3 changes: 0 additions & 3 deletions haskell-language-server.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -1848,16 +1848,13 @@ test-suite wrapper-test
benchmark benchmark
import: defaults, warnings
-- Depends on shake-bench which is unbuildable after this point
if impl(ghc >= 9.5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment above belongs to this if, so I think it should be removed too.

Copy link
Collaborator Author

@soulomoon soulomoon Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed

buildable: False
type: exitcode-stdio-1.0
ghc-options: -threaded
main-is: Main.hs
hs-source-dirs: bench
build-tool-depends:
ghcide-bench:ghcide-bench,
hp2pretty:hp2pretty,
implicit-hie:gen-hie
default-extensions:
LambdaCase
RecordWildCards
Expand Down
3 changes: 0 additions & 3 deletions shake-bench/shake-bench.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ source-repository head
location: https:/haskell/haskell-language-server.git

library
-- Depends on Chart which is unbuildable after this point
if impl(ghc >= 9.5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still true? Is chart now buildable?

Copy link
Collaborator Author

@soulomoon soulomoon Mar 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not true, we can build chart, I forget to delete them.

buildable: False
exposed-modules: Development.Benchmark.Rules
hs-source-dirs: src
build-depends:
Expand Down
2 changes: 1 addition & 1 deletion shake-bench/src/Development/Benchmark/Rules.hs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ benchRules build MkBenchRules{..} = do
++ concat
[[ "-h"
, "-i" <> show i
, "-po" <> outHp
, "-po" <> dropExtension outHp
, "-qg"]
| CheapHeapProfiling i <- [prof]]
++ ["-RTS"]
Expand Down
Loading