On 10/08/2011 10:59 PM, Martin Fick wrote:
[...]
So, with this in mind, I have discovered, that the fetch
performance degradation by invalidating the caches in
write_ref_sha1() is actually due to the packed-refs being
reloaded and resorted again on each ref insertion (not the
loose refs)!!!
Good point.
I think that all of this might explain why no matter how
good Michael's intentions are with his patch series, his
series isn't likely to fix this problem
I never claimed that my patch fixes all use cases, or cures cancer
either :-) One step at a time.
unless he does not
invalidate the packed-refs after each insertion. I tried
preventing this invalidation in his series to prove this,
but unfortunately, it appears that in his series it is no
longer possible to only invalidate just the packed-refs? :(
Michael, I hope I am completely wrong about that...
Yes, you are completely wrong. I just implemented more selective cache
invalidation on top of the patch series.
I think your suggestion is safe because only non-symbolic references can
be stored in the packed refs; therefore the modification of a loose ref
can never affect the value of a packed ref. Of course a loose ref can
*hide* the value of a packed ref, but in such cases the packed ref is
never read anyway. And the *deletion* of a loose ref can expose a
previously-hidden packed ref, but this case is handled by delete_ref(),
which explicitly invalidates the packed-ref cache.
While I was at it, I also:
* In delete_ref(), only invalidate the packed reference cache if the
reference that is being deleted actually *is* among the packed references.
* Changed the code to stop invalidating the ref caches for submodules.
In the code paths where the cache invalidation was being done, only
main-module references were being changed. However, I'm not familiar
enough with submodules to know if/when submodule references *can* be
changed. It could be that the submodule reference caches have to be
invalidated under some circumstances; the current code might be buggy in
this area.
The changes are pushed to github. They don't make any significant
difference to my "refperf" results (attached), so perhaps a new
benchmark should be added. But I'm curious to see how they affect your
timings.
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/