diff options
author | Joey Hess <joeyh@joeyh.name> | 2019-12-11 14:12:22 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2019-12-11 15:25:07 -0400 |
commit | c19211774f509f2b0334073b599295538871a00f (patch) | |
tree | 315e2b66d847f6a7141fefbe549e82f4586be691 /Logs.hs | |
parent | bdec7fed9cae4fe5c3cbdf0ee2ee6ae8530bbc19 (diff) |
use filepath-bytestring for annex object manipulations
git-annex find is now RawFilePath end to end, no string conversions.
So is git-annex get when it does not need to get anything.
So this is a major milestone on optimisation.
Benchmarks indicate around 30% speedup in both commands.
Probably many other performance improvements. All or nearly all places
where a file is statted use RawFilePath now.
Diffstat (limited to 'Logs.hs')
-rw-r--r-- | Logs.hs | 25 |
1 files changed, 13 insertions, 12 deletions
@@ -13,6 +13,7 @@ import Annex.Common import Annex.DirHashes import qualified Data.ByteString as S +import qualified System.FilePath.ByteString as P {- There are several varieties of log file formats. -} data LogVariety @@ -117,19 +118,19 @@ exportLog = "export.log" {- The pathname of the location log file for a given key. -} locationLogFile :: GitConfig -> Key -> RawFilePath -locationLogFile config key = toRawFilePath $ - branchHashDir config key </> keyFile key ++ ".log" +locationLogFile config key = + branchHashDir config key P.</> keyFile' key <> ".log" {- The filename of the url log for a given key. -} urlLogFile :: GitConfig -> Key -> RawFilePath -urlLogFile config key = toRawFilePath $ - branchHashDir config key </> keyFile key ++ decodeBS' urlLogExt +urlLogFile config key = + branchHashDir config key P.</> keyFile' key <> urlLogExt {- Old versions stored the urls elsewhere. -} oldurlLogs :: GitConfig -> Key -> [RawFilePath] -oldurlLogs config key = map toRawFilePath - [ "remote/web" </> hdir </> serializeKey key ++ ".log" - , "remote/web" </> hdir </> keyFile key ++ ".log" +oldurlLogs config key = + [ "remote/web" P.</> hdir P.</> serializeKey' key <> ".log" + , "remote/web" P.</> hdir P.</> keyFile' key <> ".log" ] where hdir = branchHashDir config key @@ -144,7 +145,7 @@ isUrlLog file = urlLogExt `S.isSuffixOf` file {- The filename of the remote state log for a given key. -} remoteStateLogFile :: GitConfig -> Key -> RawFilePath remoteStateLogFile config key = - toRawFilePath (branchHashDir config key </> keyFile key) + (branchHashDir config key P.</> keyFile' key) <> remoteStateLogExt remoteStateLogExt :: S.ByteString @@ -156,7 +157,7 @@ isRemoteStateLog path = remoteStateLogExt `S.isSuffixOf` path {- The filename of the chunk log for a given key. -} chunkLogFile :: GitConfig -> Key -> RawFilePath chunkLogFile config key = - toRawFilePath (branchHashDir config key </> keyFile key) + (branchHashDir config key P.</> keyFile' key) <> chunkLogExt chunkLogExt :: S.ByteString @@ -168,7 +169,7 @@ isChunkLog path = chunkLogExt `S.isSuffixOf` path {- The filename of the metadata log for a given key. -} metaDataLogFile :: GitConfig -> Key -> RawFilePath metaDataLogFile config key = - toRawFilePath (branchHashDir config key </> keyFile key) + (branchHashDir config key P.</> keyFile' key) <> metaDataLogExt metaDataLogExt :: S.ByteString @@ -180,7 +181,7 @@ isMetaDataLog path = metaDataLogExt `S.isSuffixOf` path {- The filename of the remote metadata log for a given key. -} remoteMetaDataLogFile :: GitConfig -> Key -> RawFilePath remoteMetaDataLogFile config key = - toRawFilePath (branchHashDir config key </> keyFile key) + (branchHashDir config key P.</> keyFile' key) <> remoteMetaDataLogExt remoteMetaDataLogExt :: S.ByteString @@ -192,7 +193,7 @@ isRemoteMetaDataLog path = remoteMetaDataLogExt `S.isSuffixOf` path {- The filename of the remote content identifier log for a given key. -} remoteContentIdentifierLogFile :: GitConfig -> Key -> RawFilePath remoteContentIdentifierLogFile config key = - toRawFilePath (branchHashDir config key </> keyFile key) + (branchHashDir config key P.</> keyFile' key) <> remoteContentIdentifierExt remoteContentIdentifierExt :: S.ByteString |