Sped up query commands that read the git-annex branch by around 5%

The only price paid is one additional MVar read per write to the journal.
Presumably writing a journal file dominiates over a MVar read time by
several orders of magnitude.

--batch does not get the speedup because then it needs to notice when
another process has made a change. Also made the assistant and other damon
modes bypass the optimisation, which would not help them anyway.
This commit is contained in:
Joey Hess 2020-04-09 13:54:43 -04:00
parent aba905152a
commit aeca7c2207
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
14 changed files with 101 additions and 25 deletions

View file

@ -22,6 +22,7 @@ import Utility.SimpleProtocol
import Utility.ThreadScheduler
import Config
import Annex.Ssh
import Annex.BranchState
import Types.Messages
import Control.Concurrent
@ -163,7 +164,9 @@ genTransportHandle = do
annexstate <- newMVar =<< Annex.new =<< Git.CurrentRepo.get
g <- Annex.repo <$> readMVar annexstate
let h = TransportHandle (LocalRepo g) annexstate
liftAnnex h $ Annex.setOutput QuietOutput
liftAnnex h $ do
Annex.setOutput QuietOutput
enableInteractiveJournalAccess
return h
updateTransportHandle :: TransportHandle -> IO TransportHandle