Skip to content

Commit b4bf796

Browse files
committed
configure bench to run semantic tokens
1 parent 10fa6ee commit b4bf796

File tree

3 files changed

+38
-25
lines changed

3 files changed

+38
-25
lines changed

bench/config.yaml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The number of samples to run per experiment.
22
# At least 100 is recommended in order to observe space leaks
3-
samples: 50
3+
samples: 1
44

55
buildTool: cabal
66

@@ -23,8 +23,9 @@ examples:
2323
package: Cabal
2424
version: 3.6.3.0
2525
modules:
26-
- src/Distribution/Simple.hs
27-
- src/Distribution/Types/Module.hs
26+
# - src/Distribution/Simple.hs
27+
# - src/Distribution/Types/Module.hs
28+
- src/Distribution/Simple/Configure.hs
2829
extra-args: [] # extra HLS command line args
2930
# Small-sized project with TH
3031
- name: lsp-types
@@ -91,20 +92,21 @@ examples:
9192

9293
# The set of experiments to execute
9394
experiments:
94-
- "edit-header"
95-
- "edit"
96-
- "hover"
97-
- "hover after edit"
95+
# - "edit-header"
96+
# - "edit"
97+
# - "hover"
98+
- "semanticTokens"
99+
# - "hover after edit"
98100
# - "hover after cradle edit"
99-
- "getDefinition"
100-
- "getDefinition after edit"
101-
- "completions"
102-
- "completions after edit"
103-
- "code actions"
104-
- "code actions after edit"
105-
- "code actions after cradle edit"
106-
- "documentSymbols after edit"
107-
- "hole fit suggestions"
101+
# - "getDefinition"
102+
# - "getDefinition after edit"
103+
# - "completions"
104+
# - "completions after edit"
105+
# - "code actions"
106+
# - "code actions after edit"
107+
# - "code actions after cradle edit"
108+
# - "documentSymbols after edit"
109+
# - "hole fit suggestions"
108110

109111
# An ordered list of versions to analyze
110112
versions:
@@ -121,15 +123,15 @@ versions:
121123

122124

123125
# - 1.8.0.0
124-
- upstream: origin/master
126+
- upstream: upstream/master
125127
# - HEAD~1
126-
- HEAD
128+
- cache-semantic-lookup
127129

128130
# A list of plugin configurations to analyze
129131
# WARNING: Currently bench versions later than e4234a3a5e347db249fccefb8e3fb36f89e8eafb
130132
# will be unable to send plugin configurations to earlier HLS versions. This causes
131133
# all plugins in those versions to always be enabled.
132-
# In addition bench proactively disables all plugins it knows about besides the
134+
# In addition bench proactively disables all plugins it knows about besides the
133135
# ones in the following list. However because it can only disable plugins it
134136
# knows about, any plugins that are in old versions but were removed from HLS
135137
# before the current bench will not be disabled.
@@ -194,6 +196,7 @@ configurations:
194196
- qualifyImportedNames
195197
- rename
196198
- stylish-haskell
199+
- semanticTokens
197200
# - alternateNumberFormat
198201
# - callHierarchy
199202
# - changeTypeSignature

ghcide-bench/src/Experiments.hs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ import Control.Applicative.Combinators (skipManyTill)
2626
import Control.Concurrent.Async (withAsync)
2727
import Control.Exception.Safe (IOException, handleAny,
2828
try)
29-
import Control.Lens (_Just, (&), (.~), (^.))
29+
import Control.Lens (_Just, (&), (.~), (^.),
30+
(^?))
3031
import Control.Lens.Extras (is)
3132
import Control.Monad.Extra (allM, forM, forM_, forever,
3233
unless, void, when,
@@ -100,7 +101,16 @@ allWithIdentifierPos f docs = case applicableDocs of
100101

101102
experiments :: HasConfig => [Bench]
102103
experiments =
103-
[ ---------------------------------------------------------------------------------------
104+
[
105+
bench "semanticTokens" $ \docs -> do
106+
liftIO $ putStrLn "Starting semanticTokens"
107+
r <- forM docs $ \DocumentPositions{..} -> do
108+
tks <- getSemanticTokens doc
109+
case tks ^? LSP._L of
110+
Just _ -> return True
111+
Nothing -> return True
112+
return $ and r,
113+
---------------------------------------------------------------------------------------
104114
bench "hover" $ allWithIdentifierPos $ \DocumentPositions{..} ->
105115
isJust <$> getHover doc (fromJust identifierP),
106116
---------------------------------------------------------------------------------------
@@ -316,7 +326,7 @@ versionP = maybeReader $ extract . readP_to_S parseVersion
316326
extract parses = listToMaybe [ res | (res,"") <- parses]
317327

318328
output :: (MonadIO m, HasConfig) => String -> m ()
319-
output = if quiet?config then (\_ -> pure ()) else liftIO . putStrLn
329+
output = if quiet ?config then (\_ -> pure ()) else liftIO . putStrLn
320330

321331
---------------------------------------------------------------------------------------
322332

@@ -597,7 +607,7 @@ callCommandLogging cmd = do
597607
setup :: HasConfig => IO SetupResult
598608
setup = do
599609
-- when alreadyExists $ removeDirectoryRecursive examplesPath
600-
benchDir <- case exampleDetails(example ?config) of
610+
benchDir <- case exampleDetails (example ?config) of
601611
ExamplePath examplePath -> do
602612
let hieYamlPath = examplePath </> "hie.yaml"
603613
alreadyExists <- doesFileExist hieYamlPath
@@ -661,7 +671,7 @@ setup = do
661671

662672
whenJust (shakeProfiling ?config) $ createDirectoryIfMissing True
663673

664-
let cleanUp = case exampleDetails(example ?config) of
674+
let cleanUp = case exampleDetails (example ?config) of
665675
ExampleHackage _ -> removeDirectoryRecursive examplesPath
666676
ExampleScript _ _ -> removeDirectoryRecursive examplesPath
667677
ExamplePath _ -> return ()

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

Lines changed: 1 addition & 1 deletion
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)