( return gitAnnexPrivateJournalDir
, return gitAnnexJournalDir
)
- createAnnexDirectory jd
-- journal file is written atomically
let jfile = journalFile file
let tmpfile = tmp P.</> jfile
- liftIO $ do
+ let write = liftIO $ do
withFile (fromRawFilePath tmpfile) WriteMode $ \h ->
writeJournalHandle h content
moveFile tmpfile (jd P.</> jfile)
+ -- avoid overhead of creating the journal directory when it already
+ -- exists
+ write `catchIO` (const (createAnnexDirectory jd >> write))
data JournalledContent
= NoJournalledContent
It sounds like it's more randomly distributed, if you're walking a tree and
adding each file you encounter, and some of them have the same content so
-the same url and key.
+the same key.
-If it was not randomly distributed, a nice optimisation would be for
+But your stace shows repeated writes for the same key, so maybe they bunch
+up? If it was not randomly distributed, a nice optimisation would be for
registerurl to buffer urls as long as the key is the same, and then do a
single write for that key of all the urls. But it can't really buffer like
that if it's randomly distributed; the buffer could use a large amount of
--- /dev/null
+[[!comment format=mdwn
+ username="joey"
+ subject="""comment 3"""
+ date="2022-07-14T16:16:35Z"
+ content="""
+I've optimised away the repeated mkdir of the journal.
+
+Probably not a big win in this particular edge case, but a nice general
+win..
+"""]]