haskell / hackage-security

Hackage security framework based on TUF (The Update Framework)
http://hackage.haskell.org/package/hackage-security
56 stars 48 forks source link

Profile the example client and see where time is spent on check-for-updates #94

Closed edsko closed 9 years ago

edsko commented 9 years ago

Results with the SHA package:

Check for updates from clean slate (no previous index)            %time  %allot
-------------------------------------------------------------------------------
rebuildTarIndex        Hackage.Security.Client.Repository.Cache   64.4   72.2
fileInfo               Hackage.Security.TUF.FileInfo              22.2   19.4

Check for updates (existing index, small delta)                   %time  %allot
-------------------------------------------------------------------------------
fileInfo               Hackage.Security.TUF.FileInfo              68.7   64.2
rebuildTarIndex        Hackage.Security.Client.Repository.Cache   27.6   32.7

This difference comes from the fact that if we do a check for updates from a clean slate, we download and SHA the (smaller) .tar.gz, but when we do an incremental update we (necessarily) SHA the much larger .tar file; hence the flip in ratios. However, we've now moved from SHA to cryptohash, and the computation of the SHA now takes up much less time even when doing an incremental update:

Check for updates (existing index, small delta)                   %time  %allot
-------------------------------------------------------------------------------
rebuildTarIndex        Hackage.Security.Client.Repository.Cache   71.6   91.2
fileInfo               Hackage.Security.TUF.FileInfo              20.9    0.0

This does however suggest that we should really rebuild the tar index incrementally (#22).