convert Key to ShortByteString
authorJoey Hess <joeyh@joeyh.name>
Wed, 6 Oct 2021 00:20:08 +0000 (20:20 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 6 Oct 2021 00:20:08 +0000 (20:20 -0400)
commit19e78816f0ed2cf178e49c48abcb9d131315cb41
tree80d438f459fde6799beea4550c4d6444d62b2d01
parent012b71e4716b79784b23ada7aa32ef16f62b6a3d
convert Key to ShortByteString

This adds the overhead of a copy when serializing and deserializing keys.
I have not benchmarked much, but runtimes seem barely changed at all by that.

When a lot of keys are in memory, it improves memory use.

And, it prevents keys sometimes getting PINNED in memory and failing to GC,
which is a problem ByteString has sometimes. In particular, git-annex sync
from a borg special remote had that problem and this improved its memory
use by a large amount.

Sponsored-by: Shae Erisson on Patreon
15 files changed:
Annex/Export.hs
Backend.hs
Backend/External.hs
Backend/Hash.hs
Backend/Utilities.hs
Backend/WORM.hs
Command/Find.hs
Crypto.hs
Database/Benchmark.hs
Key.hs
Remote/External/Types.hs
Remote/GitLFS.hs
Types/Key.hs
Upgrade/V1.hs
doc/bugs/borg_special_remote_memory_usage_high_for_large_borg_repo/comment_7_f59d9c51716892240ebd12fa80a2e58b._comment