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 improvements #1178

Merged
merged 20 commits into from
Jan 10, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0ffd75f
[test-ci] fix wibble
pepeiborra Jan 2, 2021
71dd587
[ghcide-bench] fix scrambled output
pepeiborra Jan 2, 2021
c9a3f31
[ghcide-bench] add a new experiment: getDefinition after edit
pepeiborra Jan 1, 2021
852672a
[ghcide-bench] refine the position used for identifiers
pepeiborra Jan 1, 2021
4a636ed
[ghcide-bench] Support examples with multiple FOIs
pepeiborra Jan 1, 2021
aa47904
[ghcide-bench] Allow identifierP to be optional
pepeiborra Jan 1, 2021
58bebdc
[ghcide-bench] experiments: do all edits first, then query
pepeiborra Jan 1, 2021
5224602
[ghcide-bench] Add examples with multiple FOIs
pepeiborra Jan 2, 2021
14e9794
[ghcide-bench] add a completions (without edit) experiment
pepeiborra Jan 2, 2021
940d160
[ghcide-bench] Fix indentation
pepeiborra Jan 2, 2021
a405dc8
[ghcide-bench] Fix incomplete pattern match
pepeiborra Jan 2, 2021
0aa7e10
[ghcide-bench] Include the documentContents setup in the "startup" me…
pepeiborra Jan 3, 2021
8edc348
[ghcide-bench] fix wibble
pepeiborra Dec 30, 2020
284a7ea
[ghcide-bench] add more verbose output
pepeiborra Dec 30, 2020
a71cd67
[shake-bench] Consolidate -s code
pepeiborra Dec 31, 2020
6f453cb
[bench-hist] Fix: depend on # samples
pepeiborra Jan 3, 2021
61512b1
[ghcide-bench] cache searchSymbol
pepeiborra Jan 3, 2021
c687fc1
[cabal-bench] --no-clean
pepeiborra Jan 9, 2021
d3e2dfb
Merge branch 'master' into benchmark-hardening
pepeiborra Jan 9, 2021
d9ba604
Merge branch 'master' into benchmark-hardening
pepeiborra Jan 10, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
~/.cabal/store
key: ${{ runner.os }}-${{ matrix.ghc }}-build-${{ hashFiles('cabal.project') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-bench-$${ hashFiles('cabal.project') }}
${{ runner.os }}-${{ matrix.ghc }}-bench-${{ hashFiles('cabal.project') }}
${{ runner.os }}-${{ matrix.ghc }}-build-
${{ runner.os }}-${{ matrix.ghc }}

Expand Down
21 changes: 12 additions & 9 deletions ghcide/bench/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@ examples:
# Medium-sized project without TH
- name: Cabal
version: 3.0.0.0
module: Distribution/Simple.hs
modules:
- Distribution/Simple.hs
- Distribution/Types/Module.hs
# Small-sized project with TH
- name: haskell-lsp-types
version: 0.22.0.0
module: src/Language/Haskell/LSP/Types/Lens.hs
# - path: path-to-example
# module: path-to-module
- name: lsp-types
version: 1.0.0.1
modules:
- src/Language/LSP/VFS.hs
- src/Language/LSP/Types/Lens.hs

# The set of experiments to execute
experiments:
- hover
- edit
- getDefinition
- "edit"
- "hover"
- "hover after edit"
- "getDefinition"
- "getDefinition after edit"
- "completions after edit"
- "code actions"
- "code actions after edit"
Expand Down
13 changes: 11 additions & 2 deletions ghcide/bench/exe/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,23 @@
import Control.Exception.Safe
import Experiments
import Options.Applicative
import System.IO
import Control.Monad

optsP :: Parser (Config, Bool)
optsP = (,) <$> configP <*> switch (long "no-clean")

main :: IO ()
main = do
config <- execParser $ info (configP <**> helper) fullDesc
hSetBuffering stdout LineBuffering
hSetBuffering stderr LineBuffering
(config, noClean) <- execParser $ info (optsP <**> helper) fullDesc
let ?config = config

hPrint stderr config

output "starting test"

SetupResult{..} <- setup

runBenchmarks experiments `finally` cleanUp
runBenchmarks experiments `finally` unless noClean cleanUp
14 changes: 10 additions & 4 deletions ghcide/bench/hist/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ import Experiments.Types (Example, exampleToOptions)
import qualified Experiments.Types as E
import GHC.Generics (Generic)
import Numeric.Natural (Natural)
import Development.Shake.Classes


config :: FilePath
Expand All @@ -70,7 +71,7 @@ main = shakeArgs shakeOptions {shakeChange = ChangeModtimeAndDigest} $ do
configStatic <- liftIO $ readConfigIO config
let build = outputFolder configStatic
buildRules build ghcideBuildRules
benchRules build resource (MkBenchRules (benchGhcide $ samples configStatic) "ghcide")
benchRules build resource (MkBenchRules (askOracle $ GetSamples ()) benchGhcide "ghcide")
csvRules build
svgRules build
action $ allTargets build
Expand Down Expand Up @@ -98,14 +99,18 @@ createBuildSystem userRules = do

_ <- addOracle $ \GetExperiments {} -> experiments <$> readConfig config
_ <- addOracle $ \GetVersions {} -> versions <$> readConfig config
_ <- addOracle $ \GetExamples{} -> examples <$> readConfig config
_ <- addOracle $ \(GetExample name) -> find (\e -> getExampleName e == name) . examples <$> readConfig config
_ <- versioned 1 $ addOracle $ \GetExamples{} -> examples <$> readConfig config
_ <- versioned 1 $ addOracle $ \(GetExample name) -> find (\e -> getExampleName e == name) . examples <$> readConfig config
_ <- addOracle $ \GetBuildSystem {} -> buildTool <$> readConfig config
_ <- addOracle $ \GetSamples{} -> samples <$> readConfig config

benchResource <- newResource "ghcide-bench" 1

userRules benchResource

newtype GetSamples = GetSamples () deriving newtype (Binary, Eq, Hashable, NFData, Show)
type instance RuleResult GetSamples = Natural

--------------------------------------------------------------------------------

buildGhcide :: BuildSystem -> [CmdOption] -> FilePath -> Action ()
Expand All @@ -130,9 +135,10 @@ buildGhcide Stack args out =

benchGhcide
:: Natural -> BuildSystem -> [CmdOption] -> BenchProject Example -> Action ()
benchGhcide samples buildSystem args BenchProject{..} =
benchGhcide samples buildSystem args BenchProject{..} = do
command_ args "ghcide-bench" $
[ "--timeout=3000",
"--no-clean",
"-v",
"--samples=" <> show samples,
"--csv=" <> outcsv,
Expand Down
Loading