Skip to content

Commit 7227ea2

Browse files
authored
[ghcide-bench] fix edit experiment (#2104)
I noticed that the edit experiment is reporting bogus "user time" numbers because waitForProgressDone is being satisfied by the previous iteration build. The fix is easy: wait for a freshly started build first.
1 parent a5d70ee commit 7227ea2

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

ghcide/bench/lib/Experiments.hs

+10-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ experiments =
7676
bench "edit" $ \docs -> do
7777
forM_ docs $ \DocumentPositions{..} ->
7878
changeDoc doc [charEdit stringLiteralP]
79-
waitForProgressDone -- TODO check that this waits for all of them
79+
-- wait for a fresh build start
80+
waitForProgressStart
81+
-- wait for the build to be finished
82+
waitForProgressDone
8083
return True,
8184
---------------------------------------------------------------------------------------
8285
bench "hover after edit" $ \docs -> do
@@ -390,6 +393,12 @@ data BenchRun = BenchRun
390393
badRun :: BenchRun
391394
badRun = BenchRun 0 0 0 0 0 False
392395

396+
waitForProgressStart :: Session ()
397+
waitForProgressStart = void $ do
398+
skipManyTill anyMessage $ satisfy $ \case
399+
FromServerMess SWindowWorkDoneProgressCreate _ -> True
400+
_ -> False
401+
393402
-- | Wait for all progress to be done
394403
-- Needs at least one progress done notification to return
395404
waitForProgressDone :: Session ()

0 commit comments

Comments
 (0)