From: Junio C Hamano <hidden> Date: 2016-06-15 22:53:06
Jeff King [off-list ref] writes:
That being said, we do have an index extension to store the tree sha1 of
whole directories (i.e., we populate it when we write a whole tree or
subtree into the index from the object db, and it becomes invalidated
when a file becomes modified). This optimization is used by things like
"git commit" to avoid having to recreate the same sub-trees over and
over when creating tree objects from the index. But we could also use it
here to avoid having to even read the sub-tree objects from the object
db.
Like b65982b (Optimize "diff-index --cached" using cache-tree, 2009-05-20)
perhaps?
From: Jeff King <hidden> Date: 2016-06-15 22:53:06
On Fri, Feb 17, 2012 at 02:25:25PM -0800, Junio C Hamano wrote:
Jeff King [off-list ref] writes:
quoted
That being said, we do have an index extension to store the tree sha1 of
whole directories (i.e., we populate it when we write a whole tree or
subtree into the index from the object db, and it becomes invalidated
when a file becomes modified). This optimization is used by things like
"git commit" to avoid having to recreate the same sub-trees over and
over when creating tree objects from the index. But we could also use it
here to avoid having to even read the sub-tree objects from the object
db.
Like b65982b (Optimize "diff-index --cached" using cache-tree, 2009-05-20)
perhaps?
That's what I get for speaking before running "git log".
So yeah, we may be about as reasonably fast as we can go. Or maybe that
optimization isn't kicking in for some reason. I think going further
would require Piotr to do more profiling.
-Peff
From: Piotr Krukowiecki <hidden> Date: 2016-06-15 22:53:06
On Fri, Feb 17, 2012 at 11:29 PM, Jeff King [off-list ref] wrote:
On Fri, Feb 17, 2012 at 02:25:25PM -0800, Junio C Hamano wrote:
quoted
Jeff King [off-list ref] writes:
quoted
That being said, we do have an index extension to store the tree sha1 of
whole directories (i.e., we populate it when we write a whole tree or
subtree into the index from the object db, and it becomes invalidated
when a file becomes modified). This optimization is used by things like
"git commit" to avoid having to recreate the same sub-trees over and
over when creating tree objects from the index. But we could also use it
here to avoid having to even read the sub-tree objects from the object
db.
Like b65982b (Optimize "diff-index --cached" using cache-tree, 2009-05-20)
perhaps?
That's what I get for speaking before running "git log".
So yeah, we may be about as reasonably fast as we can go. Or maybe that
optimization isn't kicking in for some reason. I think going further
would require Piotr to do more profiling.
Is the cache set? Not sure how to check it. t0090-cache-tree.sh uses
test-dump-cache-tree and executes "read-tree HEAD" to establish the
cache, but in my case read-tree does not make the cache dumpable (but
it improves status performance).
$ test-dump-cache-tree | wc -l
0
$ git read-tree HEAD
$ test-dump-cache-tree | wc -l
0
$ echo 3 | sudo tee /proc/sys/vm/drop_caches && time git status -- .
[...]
real 0m1.085s
git version 1.7.9.188.g12766
--
Piotr Krukowiecki
From: Jeff King <hidden> Date: 2016-06-15 22:53:06
On Mon, Feb 20, 2012 at 09:25:00AM +0100, Piotr Krukowiecki wrote:
Is the cache set? Not sure how to check it. t0090-cache-tree.sh uses
test-dump-cache-tree and executes "read-tree HEAD" to establish the
cache, but in my case read-tree does not make the cache dumpable (but
it improves status performance).
$ test-dump-cache-tree | wc -l
0
$ git read-tree HEAD
$ test-dump-cache-tree | wc -l
0
$ echo 3 | sudo tee /proc/sys/vm/drop_caches && time git status -- .
[...]
real 0m1.085s
Hmm. I would think test-dump-cache-tree would do it. I don't know why
read-tree wouldn't fill it in, though.
Interestingly, on my git.git repo, I had an empty cache. Running "git
read-tree HEAD" filled it (according to test-dump-cache-tree). It seems
that running "git checkout" empties the cache. So perhaps git could do
better about keeping the cache valid over time.
-Peff
On Mon, Feb 20, 2012 at 9:06 PM, Jeff King [off-list ref] wrote:
Interestingly, on my git.git repo, I had an empty cache. Running "git
read-tree HEAD" filled it (according to test-dump-cache-tree). It seems
that running "git checkout" empties the cache. So perhaps git could do
better about keeping the cache valid over time.
For fast forward case when result index matches 100% destination tree,
yeah we should repopulate cache-tree. "git reset" does that. Not sure
about other cases though. I don't think we can keep track what
subtrees are unchanged after unpack_trees() in order to keep them.
--
Duy
From: Jeff King <hidden> Date: 2016-06-15 22:53:06
On Mon, Feb 20, 2012 at 09:16:43PM +0700, Nguyen Thai Ngoc Duy wrote:
On Mon, Feb 20, 2012 at 9:06 PM, Jeff King [off-list ref] wrote:
quoted
Interestingly, on my git.git repo, I had an empty cache. Running "git
read-tree HEAD" filled it (according to test-dump-cache-tree). It seems
that running "git checkout" empties the cache. So perhaps git could do
better about keeping the cache valid over time.
For fast forward case when result index matches 100% destination tree,
yeah we should repopulate cache-tree. "git reset" does that. Not sure
about other cases though. I don't think we can keep track what
subtrees are unchanged after unpack_trees() in order to keep them.
Yeah, doing it after unpack_trees seems crazy. But I really feel like
unpack_trees should be able to handle cache updates as it unpacks. It
knows what is being updated and what is being merged. But maybe it is
more complicated than that; I haven't looked at the code yet.
-Peff