You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf: Group together packages by repo when verifying tarballs (haskell#10121)
verifyFetchedTarball has the effect of deserialising the index tarball
(see call to Sec.withIndex).
verifyFetchedTarball is called individually for each package in the
build plan (see ProjectPlanning.hs). Not once per repo.
The hackage tarball is now 880mb so it takes a non significant amount of
time to deserialise this (much better after haskell/tar#95).
This code path is important as it can add 1s with these 38 calls on to
the initial load of a project and scales linearly with the size of your
build tree.
Reproducer: Simple project with "lens" dependency deserialises the index tarball 38 times.
Solution: Refactor verifyFetchedTarball to run once per repo rather than once per package.
In future it would be much better to refactor this function so that the
items are not immediately grouped and ungrouped but I didn't want to
take that on immediately.
Fixeshaskell#10110
(cherry picked from commit 7d46115)
Co-authored-by: Matthew Pickering <[email protected]>
Left e -> warn verbosity ("Error verifying fetched tarball "++ file ++", will redownload: "++show (e ::SomeException)) >>pureFalse
163
-
Right b ->pure b
164
-
in handleError $do
165
-
exists <- doesFileExist file
166
-
ifnot exists
167
-
thenreturnTrue-- if the file does not exist, it vacuously passes validation, since it will be downloaded as necessary with what we will then check is a valid hash.
168
-
elsecase repo of
169
-
-- a secure repo has hashes we can compare against to confirm this is the correct file.
Left e -> warn verbosity ("Error verifying fetched tarball "++ file ++", will redownload: "++show (e ::SomeException)) >>pureFalse
191
+
Right b ->pure b
192
+
in
193
+
handleError $do
194
+
exists <- doesFileExist file
195
+
ifnot exists
196
+
thenreturnTrue-- if the file does not exist, it vacuously passes validation, since it will be downloaded as necessary with what we will then check is a valid hash.
197
+
elsecase mCallbacks of
198
+
-- a secure repo has hashes we can compare against to confirm this is the correct file.
199
+
Just callbacks ->
200
+
let warnAndFail s = warn verbosity ("Fetched tarball "++ file ++" does not match server, will redownload: "++ s) >>returnFalse
201
+
in-- the do block in parens is due to dealing with the checked exceptions mechanism.
0 commit comments