@@ -62,52 +62,51 @@ allWithIdentifierPos f docs = allM f (filter (isJust . identifierP) docs)
62
62
experiments :: [Bench ]
63
63
experiments =
64
64
[ ---------------------------------------------------------------------------------------
65
- bench " hover" 10 $ allWithIdentifierPos $ \ DocumentPositions {.. } ->
65
+ bench " hover" $ allWithIdentifierPos $ \ DocumentPositions {.. } ->
66
66
isJust <$> getHover doc (fromJust identifierP),
67
67
---------------------------------------------------------------------------------------
68
- bench " edit" 10 $ \ docs -> do
68
+ bench " edit" $ \ docs -> do
69
69
forM_ docs $ \ DocumentPositions {.. } ->
70
70
changeDoc doc [charEdit stringLiteralP]
71
71
waitForProgressDone -- TODO check that this waits for all of them
72
72
return True ,
73
73
---------------------------------------------------------------------------------------
74
- bench " hover after edit" 10 $ \ docs -> do
74
+ bench " hover after edit" $ \ docs -> do
75
75
forM_ docs $ \ DocumentPositions {.. } ->
76
76
changeDoc doc [charEdit stringLiteralP]
77
77
flip allWithIdentifierPos docs $ \ DocumentPositions {.. } ->
78
78
isJust <$> getHover doc (fromJust identifierP),
79
79
---------------------------------------------------------------------------------------
80
- bench " getDefinition" 10 $ allWithIdentifierPos $ \ DocumentPositions {.. } ->
80
+ bench " getDefinition" $ allWithIdentifierPos $ \ DocumentPositions {.. } ->
81
81
not . null <$> getDefinitions doc (fromJust identifierP),
82
82
---------------------------------------------------------------------------------------
83
- bench " getDefinition after edit" 10 $ \ docs -> do
83
+ bench " getDefinition after edit" $ \ docs -> do
84
84
forM_ docs $ \ DocumentPositions {.. } ->
85
85
changeDoc doc [charEdit stringLiteralP]
86
86
flip allWithIdentifierPos docs $ \ DocumentPositions {.. } ->
87
87
not . null <$> getDefinitions doc (fromJust identifierP),
88
88
---------------------------------------------------------------------------------------
89
- bench " documentSymbols" 100 $ allM $ \ DocumentPositions {.. } -> do
89
+ bench " documentSymbols" $ allM $ \ DocumentPositions {.. } -> do
90
90
fmap (either (not . null ) (not . null )) . getDocumentSymbols $ doc,
91
91
---------------------------------------------------------------------------------------
92
- bench " documentSymbols after edit" 100 $ \ docs -> do
92
+ bench " documentSymbols after edit" $ \ docs -> do
93
93
forM_ docs $ \ DocumentPositions {.. } ->
94
94
changeDoc doc [charEdit stringLiteralP]
95
95
flip allM docs $ \ DocumentPositions {.. } ->
96
96
either (not . null ) (not . null ) <$> getDocumentSymbols doc,
97
97
---------------------------------------------------------------------------------------
98
- bench " completions" 10 $ \ docs -> do
98
+ bench " completions" $ \ docs -> do
99
99
flip allWithIdentifierPos docs $ \ DocumentPositions {.. } ->
100
100
not . null <$> getCompletions doc (fromJust identifierP),
101
101
---------------------------------------------------------------------------------------
102
- bench " completions after edit" 10 $ \ docs -> do
102
+ bench " completions after edit" $ \ docs -> do
103
103
forM_ docs $ \ DocumentPositions {.. } ->
104
104
changeDoc doc [charEdit stringLiteralP]
105
105
flip allWithIdentifierPos docs $ \ DocumentPositions {.. } ->
106
106
not . null <$> getCompletions doc (fromJust identifierP),
107
107
---------------------------------------------------------------------------------------
108
108
benchWithSetup
109
109
" code actions"
110
- 10
111
110
( \ docs -> do
112
111
unless (any (isJust . identifierP) docs) $
113
112
error " None of the example modules is suitable for this experiment"
@@ -122,7 +121,6 @@ experiments =
122
121
---------------------------------------------------------------------------------------
123
122
benchWithSetup
124
123
" code actions after edit"
125
- 10
126
124
( \ docs -> do
127
125
unless (any (isJust . identifierP) docs) $
128
126
error " None of the example modules is suitable for this experiment"
@@ -136,6 +134,37 @@ experiments =
136
134
not . null . catMaybes <$> forM docs (\ DocumentPositions {.. } -> do
137
135
forM identifierP $ \ p ->
138
136
getCodeActions doc (Range p p))
137
+ ),
138
+ ---------------------------------------------------------------------------------------
139
+ benchWithSetup
140
+ " code actions after cradle edit"
141
+ ( \ docs -> do
142
+ unless (any (isJust . identifierP) docs) $
143
+ error " None of the example modules is suitable for this experiment"
144
+ forM_ docs $ \ DocumentPositions {.. } ->
145
+ forM_ identifierP $ \ p -> changeDoc doc [charEdit p]
146
+ )
147
+ ( \ docs -> do
148
+ Just hieYaml <- uriToFilePath <$> getDocUri " hie.yaml"
149
+ liftIO $ appendFile hieYaml " ##\n "
150
+ sendNotification WorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams $
151
+ List [ FileEvent (filePathToUri " hie.yaml" ) FcChanged ]
152
+ forM_ docs $ \ DocumentPositions {.. } ->
153
+ changeDoc doc [charEdit stringLiteralP]
154
+ waitForProgressDone
155
+ not . null . catMaybes <$> forM docs (\ DocumentPositions {.. } -> do
156
+ forM identifierP $ \ p ->
157
+ getCodeActions doc (Range p p))
158
+ ),
159
+ ---------------------------------------------------------------------------------------
160
+ bench
161
+ " hover after cradle edit"
162
+ (\ docs -> do
163
+ Just hieYaml <- uriToFilePath <$> getDocUri " hie.yaml"
164
+ liftIO $ appendFile hieYaml " ##\n "
165
+ sendNotification WorkspaceDidChangeWatchedFiles $ DidChangeWatchedFilesParams $
166
+ List [ FileEvent (filePathToUri " hie.yaml" ) FcChanged ]
167
+ flip allWithIdentifierPos docs $ \ DocumentPositions {.. } -> isJust <$> getHover doc (fromJust identifierP)
139
168
)
140
169
]
141
170
@@ -208,21 +237,20 @@ select Bench {name, enabled} =
208
237
209
238
benchWithSetup ::
210
239
String ->
211
- Natural ->
212
240
([DocumentPositions ] -> Session () ) ->
213
241
Experiment ->
214
242
Bench
215
- benchWithSetup name samples benchSetup experiment = Bench {.. }
243
+ benchWithSetup name benchSetup experiment = Bench {.. }
216
244
where
217
245
enabled = True
246
+ samples = 100
218
247
219
- bench :: String -> Natural -> Experiment -> Bench
220
- bench name defSamples =
221
- benchWithSetup name defSamples (const $ pure () )
248
+ bench :: String -> Experiment -> Bench
249
+ bench name = benchWithSetup name (const $ pure () )
222
250
223
251
runBenchmarksFun :: HasConfig => FilePath -> [Bench ] -> IO ()
224
252
runBenchmarksFun dir allBenchmarks = do
225
- let benchmarks = [ b{samples = fromMaybe (samples b) (repetitions ? config) }
253
+ let benchmarks = [ b{samples = fromMaybe 100 (repetitions ? config) }
226
254
| b <- allBenchmarks
227
255
, select b ]
228
256
0 commit comments