Skip to content
  • Joey Hess's avatar
    cache the serialization of a Key · 81d40221
    Joey Hess authored
    This will speed up the common case where a Key is deserialized from
    disk, but is then serialized to build eg, the path to the annex object.
    
    Previously attempted in 4536c93b
    and reverted in 96aba8ef.
    The problems mentioned in the latter commit are addressed now:
    
    Read/Show of KeyData is backwards-compatible with Read/Show of Key from before
    this change, so Types.Distribution will keep working.
    
    The Eq instance is fixed.
    
    Also, Key has smart constructors, avoiding needing to remember to update
    the cached serialization.
    
    Used git-annex benchmark:
      find is 7% faster
      whereis is 3% faster
      get when all files are already present is 5% faster
    Generally, the benchmarks are running 0.1 seconds faster per 2000 files,
    on a ram disk in my laptop.
    81d40221