Yes.
I debated that a bit with myself, but decided that:
(a) it probably doesn't really matter a lot (but I don't have the
numbers)
(b) trying to *also* fill non-delta-base queries from the delta-base
cache actually complicates things a lot. Surprisingly much so (the
current logic of removing the entry from the cache only to re-insert
it after being used made the memory management totally trivial, as
you noticed)
(c) and regardless, we could decide to do a more extensive caching layer
later if we really wanted to, and at that point it probably makes
more sense to integrate it with the delta-base cache.
Most git objects are use-once, which is why we really *just* save the
flag bits and the SHA1 hash name itself in "struct object", but doing
a generic caching layer for object content would likely obviate the
need for the current logic to do "save_commit_buffer".
That (c) in particular was what made me think that it's better to keep it
simple and obvious for now, since even the simple thing largely fixes the
performance issue. Almost three seconds I felt bad about, while just over
a second for something as complex as "git log drivers/usb/" I just cannot
make myself worry about.
Yeah. I think it would be good to probably (separately and as "further
tweaks"):
- have somebody actually look at hit-rates for different repositories and
hash sizes.
- possibly allow people to set the hash size as a config option, if it
turns out that certain repository layouts or usage scenarios end up
preferring bigger caches.
For example, it may be that for historical archives you might want to
have deeper delta queues to make the repository smaller, and if they
are big anyway maybe they would prefer to have a larger-than-normal
cache as a result. On the other hand, if you are memory-constrained,
maybe you'd prefer to re-generate the objects and waste a bit of CPU
rather than cache the results.
But neither of the above is really an argument against the patch, just a
"there's certainly room for more work here if anybody cares".
I'm pretty happy with the results myself. Partly because the patches just
ended up looking so *nice*.
Linus
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html