Skip to content

Commit

Permalink
[ghcide-bench] fix edit experiment (#2104)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pepeiborra authored Aug 18, 2021
1 parent a5d70ee commit 7227ea2
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion ghcide/bench/lib/Experiments.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ experiments =
bench "edit" $ \docs -> do
forM_ docs $ \DocumentPositions{..} ->
changeDoc doc [charEdit stringLiteralP]
waitForProgressDone -- TODO check that this waits for all of them
-- wait for a fresh build start
waitForProgressStart
-- wait for the build to be finished
waitForProgressDone
return True,
---------------------------------------------------------------------------------------
bench "hover after edit" $ \docs -> do
Expand Down Expand Up @@ -390,6 +393,12 @@ data BenchRun = BenchRun
badRun :: BenchRun
badRun = BenchRun 0 0 0 0 0 False

waitForProgressStart :: Session ()
waitForProgressStart = void $ do
skipManyTill anyMessage $ satisfy $ \case
FromServerMess SWindowWorkDoneProgressCreate _ -> True
_ -> False

-- | Wait for all progress to be done
-- Needs at least one progress done notification to return
waitForProgressDone :: Session ()
Expand Down

0 comments on commit 7227ea2

Please sign in to comment.